[racket] Some struct questions
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 15-07-12 17:40, Harry Spier wrote:
> 1) In section 8 of the Racket reference there is this example:
> ------------------------------------------- Examples:
> (define-struct tree (val left right))
>
>> (match (make-tree 0 (make-tree 1 #f #f) #f)
> [(tree a (tree b _ _) _) (list a b)])
>
> '(0 1) ----------------------------------
>
> but I wasn't able to find any reference in the documentation to a
> constructor form make-struct-id . I'm assuming that in the above
> example (match (make-tree 0 (make-tree 1 #f #f) #f) is equivalent
> to (match (tree 0 (tree 1 #f #f) #f)
>
> Is that correct? Is make-struct-id a deprecated form of the
> constructor procedure struct-id?
I believe define-struct is the deprecated struct-defining form
creating a "make-"-prefixed constructor and the new way is `struct'
which creates constructors with the name of the struct.
Marijn
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.19 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAlAEBSEACgkQp/VmCx0OL2wfqQCfUaFVPm0Ci3wtmIX4MUY+fb60
7x0AnRPQNz3Yz6r1RPL3w8FqQg3QC/k8
=fEMY
-----END PGP SIGNATURE-----