RosettaCodeData/Task/Object-serialization/TXR/object-serialization-1.txr

23 lines
481 B
Plaintext

(defstruct shape ()
(pos-x 0.0) (pos-y 0.0))
(defstruct circle (shape)
radius)
(defstruct ellipse (shape)
min-radius maj-radius)
(defvarl shapes (list (new circle radius 3.0)
(new ellipse min-radius 4.0 maj-radius 5.0)))
(put-line "original shapes:")
(prinl shapes)
(file-put "shapes.tl" shapes)
(put-line "dump of shapes.tl file:")
(put-line (file-get-string "shapes.tl"))
(put-line "object list read from file:")
(prinl (file-get "shapes.tl"))