[plt-scheme] Writing structures
Thanks Richard,
Your suggestion worked well. However I noticed I do not need any special
inspectors if I use print instead of write. In fact:
(define-struct my-struct (field1
field2
field3))
(print (make-my-struct 1 2 3))
and
(define-struct my-struct (field1
field2
field3)
(make-inspector))
(write (struct->vector (make-my-struct 1 2 3))
write out s-exp's that when read define two equal vectors.
I know very little about inspectors so I cannot tell which approach is
better. Do you have recommendations on one way over the other?
Thanks for the help,
-pp
PS: I used the match library to parse as you suggested and was blown away by
it. Coming from a Pascal/C++/C#/C background I am amazed one can implement
what seems to be a radically different syntax without messing with the
language definition.