[racket] prop:procedure and arity
At Mon, 9 Feb 2015 19:36:56 -0500, "Alexander D. Knauth" wrote:
> Say I want a struct that will act as a procedure.
> For a given instance of that struct, I want the procedure to have a given
> arity, but I don’t want the procedure to be a field in the struct.
> Is there a way to do this without making the procedure a field?
I think there's no way to do that, assuming that you want a single
constructor that answers #t to `struct-constructor-procedure?`.
If you get to substitute a function for the constructor, then you could
make that function use `procedure-reduce-arity` on each raw instance,
or you could generate a structure subtype for each arity and
instantiate a subtype based on field values.