[racket] build-struct-generation
build-struct-generation is a really useful utility, but I don't
understand how to use it. Specifically, see
Welcome to DrRacket, version 5.1.3 [3m].
Language: racket; memory limit: 128 MB.
> (require syntax/struct)
> (build-struct-generation #'p (list #'x #'y) #f #f)
'(let-values (((struct: make- ? acc mut)
(make-struct-type
'.#<syntax:5:29 p>
#f
2
0
#f
() ;; <---
(current-inspector)
#f
()))) ;; <---
(values
struct:
make-
?
(make-struct-field-accessor acc 0 '.#<syntax:5:39 x>)
(make-struct-field-mutator mut 0 '.#<syntax:5:39 x>)
(make-struct-field-accessor acc 1 '.#<syntax:5:43 y>)
(make-struct-field-mutator mut 1 '.#<syntax:5:43 y>)))
Note the two empty lists in the output [()'s with the default printer;
in constructor mode they come out as empty's]. They correspond to
props : (listof (cons/c struct-type-property? any/c)) = null
immutables : (listof exact-nonnegative-integer?) = null
However, these are in code that it meant to subsequently be
evaluated. When used, for instance, in a macro, I get
#%app: missing procedure expression; probably originally (), which
is an illegal empty application in: (#%app)
Is it possible to get a simple example of how to use this?
Shriram