Re: [racket] struct constructors

2014-05-28 Thread Matthias Felleisen
You can have protection and subclassing like in the (running) sketch below. Something like this may work for structs. -- Matthias #lang racket (module server racket (provide ;; exists: Class c% ;; Any -> (Instance-of c%) make-c ;; Any -> Boolean is-c%? ;;

Re: [racket] struct constructors

2014-05-27 Thread David T. Pierson
On Tue, May 27, 2014 at 07:25:34PM +1200, Aidan Gauland wrote: > What's the nearest equivalent for a struct to constructors for class > instances? Say I have a struct with a field that should be initialised > to a three-element vector. Right now, I'm just defining a wrapper > make-blah. > > (str

Re: [racket] struct constructors

2014-05-27 Thread Jay McCarthy
It is not what you need. When you create a new structure, the constructor is the thing that makes it... in your example that's "blah". The keyword you mentioned lets you change that name to something like "mother-in-law", so (struct blah (a b c v) #:constructor-name mother-in-law) (mother-in-law