[plt-scheme] Re: newbie question: printing structs?
That's more a question for the PLT team, but I suggest you read section 4.5 of the PLT language manual. Among other things, structure inspectors make it possible to make structs opaque for some parts of a program and visible for other parts.
Jos
(((((lambda(x)((((((((x x)x)x)x)x)x)x)x))
(lambda(x)(lambda(y)(x(x y)))))
(lambda(x)(x)x))
(lambda()(printf "Greetings, Jos~n"))))
----- Original Message -----
From: George Herson
To: jos koot ; PLT-Scheme mailing list
Sent: Wednesday, March 14, 2007 2:58 PM
Subject: Re: [plt-scheme] Re: newbie question: printing structs?
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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20070314/85fc0d37/attachment.html>