Re: [racket] Some struct questions

2012-07-16 Thread Ryan Culpepper
On 07/16/2012 12:39 PM, Harry Spier wrote: I should have been a little clearer with my question. I understand that its not a good idea to expose the setters and getters of a struct unnecessarily. What I meant was: (provide struct-id) exposes the struct constructor (provide (struct-out struct-i

Re: [racket] Some struct questions

2012-07-16 Thread Tony Garnock-Jones
On 07/16/2012 12:39 PM, Harry Spier wrote: what use is having access to the constructor without access to the field getters and setters. One possible answer to this is that you can match on a structure with just its constructor in scope: ;; s.rkt #lang racket (provide foo) (struct foo (bar b

Re: [racket] Some struct questions

2012-07-16 Thread Harry Spier
I should have been a little clearer with my question. I understand that its not a good idea to expose the setters and getters of a struct unnecessarily. What I meant was: (provide struct-id) exposes the struct constructor (provide (struct-out struct-id)) exposes the constructor and the field get

Re: [racket] Some struct questions

2012-07-16 Thread Marijn
-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) >

Re: [racket] Some struct questions

2012-07-15 Thread Adolfo Pérez Álvarez
Hi, Section 4 of the Racket reference says this about `define-struct': """ Like struct, except that the syntax for supplying a super-id is different, and a constructor-id that has a make- prefix on id is implicitly supplied via #:extra-constructor-name. This form is provided for backwards compat