14 lines
362 B
Plaintext
14 lines
362 B
Plaintext
(defstruct shape ()
|
|
(pos-x 0.0) (pos-y 0.0))
|
|
|
|
(defstruct circle (shape)
|
|
radius
|
|
(:method print (me stream pretty-p)
|
|
(if pretty-p
|
|
(put-string `#<circle of radius @{me.radius} at coordinates (@{me.pos-x}, @{me.pos-y})>`)
|
|
:)))
|
|
|
|
(let ((circ (new circle radius 5.3)))
|
|
(prinl circ) ;; print machine readably
|
|
(pprinl circ)) ;; print pretty
|