Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
22
Task/Object-serialization/TXR/object-serialization-1.txr
Normal file
22
Task/Object-serialization/TXR/object-serialization-1.txr
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
(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"))
|
||||
13
Task/Object-serialization/TXR/object-serialization-2.txr
Normal file
13
Task/Object-serialization/TXR/object-serialization-2.txr
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
(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
|
||||
Loading…
Add table
Add a link
Reference in a new issue