Category : Files from Magazines
Archive   : DDJ9210.ZIP
Filename : DYLAN.ASC

 
Output of file : DYLAN.ASC contained in archive : DDJ9210.ZIP
_A TASTE OF DYLAN_
by David Betz



Example 1: A Dylan class definition

(define-class ()
(x required-init-keyword: x:)
(y required-init-keyword: y:))



Example 2: (a) using setter functions to change the value of a slot;
(b) calling the setter function directly; (c) an alternate use of
the setter function

(a)

(define foo (make 😡 12 y: 23))
(x foo) => 12
(y foo) => 23


(b)

((setter x) foo 99)

(c)

(set! (x foo) 99)



Example 3: The doubly-linked list mixin

(a)

(define-class ()
next
prev)

(b)

(define-class ( ))

Example 4: Defining methods for classes that use the entity> mixin

(define-method initialize ((x ))
(next-method)
(set! (next x) x)
(set! (prev x) x))

(define-method add-after ((e1 )
(e2 ))
(bind ((e3 (next e1)))
(set! (next e1) e2)
(set! (next e2) e3)
(set! (prev e3) e2)

(set! (prev e2) e1)))

Example 5: (a) defining a method for that returns both coordinates;
(b) binding the two values in (a) to variables


(a)

(define-method coordinates ((p ))
(values (x p) (y p)))

(b)

(bind ((x y (coordinates foo)))
... do something with x and y ...
)



  3 Responses to “Category : Files from Magazines
Archive   : DDJ9210.ZIP
Filename : DYLAN.ASC

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/