[racket] struct constructors

From: Aidan Gauland (aidalgol at amuri.net)
Date: Tue May 27 03:25:34 EDT 2014

Hello fellow racketeers,

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.

(struct blah (a b c v))

(define (make-blah)
  (blah 0 0 0 #(0 0 0))

This seems fine, but I see that there's a keyword argument to the
`struct' procedure #:constructor-name and I can't quite make sense of
what that does.  Is it a low-level thing, or is it exactly what I want?

Thanks,
Aidan Gauland



Posted on the users mailing list.