[plt-scheme] Writing structures

From: Paul Graunke (ptg at ccs.neu.edu)
Date: Mon Jan 20 16:09:59 EST 2003

The first attempt (without inspectors) does not work within mzscheme,
though it may work within DrScheme.  The inspector approach works in
both cases.

Paul

At Mon, 20 Jan 2003 16:06:16 -0500, "Pedro Pinto" wrote:
>   For list-related administrative tasks:
>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme
> 
> 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.