[plt-scheme] Writing structures

From: Pedro Pinto (ppinto at cs.cmu.edu)
Date: Mon Jan 20 16:06:16 EST 2003

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.








Posted on the users mailing list.