[racket] build-struct-generation
The `build-struct-generation' function is indeed broken. It originated
in the `mzscheme' days when an empty application produced an empty
list.
I'll fix it. Meanwhile, you can work around the problem by supplying
the last two optional arguments (which don't have keywords --- another
sign of an old function) as '(list) or #'(list) instead of the default
'().
Alternatively, one reason that `build-struct-generation' rotted may be
that we switched to using `struct/derived' as a better way of writing
`struct'-like forms, so you might try that approach if it applies.
At Sat, 3 Sep 2011 08:06:11 -0400, Shriram Krishnamurthi wrote:
> 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
> _________________________________________________
> For list-related administrative tasks:
> http://lists.racket-lang.org/listinfo/users