[plt-scheme] Re: newbie question: printing structs?

From: George Herson (gherson at snet.net)
Date: Wed Mar 14 09:58:17 EDT 2007

Good to know, Jos.

Why aren't structures made with this minimal inspector
by default?  I had a pretty confusing time with this
myself.  Fundamental to understanding anything with
contents is seeing them.

Does creation of structures occur alot faster than
creation of equivalent (small) hash tables?

thank you,
george

--- jos koot <jos.koot at telefonica.net> wrote:

> You also will have to take care of the inspector,
> i.e:
> 
> (define-struct a (x y z))
> (define sa (make-a 1 2 3))
> sa ; --> #<struct:a>
> 
> (define inspector (make-inspector))
> (define-struct b (x y z) inspector)
> (define sb (make-b 1 2 3))
> sb ; --> #(struct:b 1 2 3)
> 
> Jos
> 
> ----- Original Message ----- 
>   From: Andrew Reilly 
>   To: PLT-Scheme mailing list 
>   Sent: Tuesday, March 13, 2007 7:30 AM
>   Subject: [plt-scheme] Re: newbie question:
> printing structs?
> 
> 
>   On Tue, Mar 13, 2007 at 04:53:11PM +1100, Andrew
> Reilly wrote:
>   > When debugging, how can I print the entire
> contents of a struct?
> 
>   Aah.  I think I've just got it:
>   (print-struct #t) gates subsequent display of
> struct contents, which is also
>   gated by the #f argument to define-struct.  Neat.
> 
>   Cheers,
> 
>   -- 
>   Andrew
>   _________________________________________________
>     For list-related administrative tasks:
>    
> http://list.cs.brown.edu/mailman/listinfo/plt-scheme
> > _________________________________________________
>   For list-related administrative tasks:
>  
> http://list.cs.brown.edu/mailman/listinfo/plt-scheme
> 



Posted on the users mailing list.