[gambit-list] #!key behavior

Marc Feeley 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.

Marc

> On Dec 18, 2015, at 2:00 AM, Adam <adam.mlmb at gmail.com> wrote:
> 
> Marc,
> 
> Sometimes, it can be useful to have a procedure that splices out some key arguments and then passes on the remainder.
> 
> E.g.,
> 
> (define (outerproc #!key a b #!rest r)
>   logics
>   (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?
> 
> Thanks,
> Adam
> 




More information about the Gambit-list mailing list