[gambit-list] #!key behavior
feeley at iro.umontreal.ca
Fri Dec 18 09:47:13 EST 2015
To obtain the behavior you want, put the rest parameter before the keyword parameters:
(define (outerproc #!rest r #!key a b) …)
This way, r will contain all parameters, including any keyword parameters that aren’t a or b.
> On Dec 18, 2015, at 2:00 AM, Adam <adam.mlmb at gmail.com> wrote:
> Sometimes, it can be useful to have a procedure that splices out some key arguments and then passes on the remainder.
> (define (outerproc #!key a b #!rest r)
> (apply innerproc r))
> (define (innerproc #!key c d)
> Currently, doing (outerproc c: myvalue) causes runtime error "Unknown keyword argument passed to procedure".
> What's the motivation for this?
> Would you feel that it could be relevant to include a |declare| that would alter this behavior?
More information about the Gambit-list