[racket] struct in racket
By default, struct defines an "opaque" structure. You can do something
like this:
> (struct posn (x y) #:transparent)
> (struct? (posn 3 4))
#t
See the documentation for struct in the reference.
HTH,
--- nadeem
On Sun, Sep 5, 2010 at 10:05 PM, 趙Frodo <frodogreat at gmail.com> wrote:
> I don't know if I did something wrong or not, but this seems strange to me.
>
> Using #lang racket, in the interaction window from DrRacket (DrRacket,
> version 5.0.1, english by PLT),
>
>> (struct posn (x y))
>> (struct? (posn 3 4))
> #f
>> (struct-info? (posn 3 4))
> #f
> #t
>>
>
> So (posn 3 4) is not a struct in racket? The same goes for define-struct.
> But
>
>> (struct-constructor-procedure? posn)
> #t
>>
>
> Usually how people define structure in Racket?
>
> Cheers,
> Frodo
>
>
> _________________________________________________
> For list-related administrative tasks:
> http://lists.racket-lang.org/listinfo/users
>