[plt-scheme] passing-on keyword arguments

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Tue Mar 18 14:38:26 EDT 2008

Macros?

On Mar 18, 2008, at 1:36 PM, Rob Hunter wrote:

> I've run into this issue a few times, and thought I'd finally post
> here.  I'd like to wrap a function that takes keyword arguments, but
> pass-on some/all of the keyword arguments from the outer function to
> the inner function.  For example,
>
> (define (inner #:x [x 10]) (* x x))
>
> (define (outer #:x [x 10]) (+ (inner #:x x) 5))
>
> This works, but I'm duplicating code.  Specifically, I had to
> duplicate the default value for the "x" argument.  Any nice way of
> writing outer and letting it defer to inner to get the default value
> for x?
>
> Thanks,
> Rob
> _________________________________________________
>   For list-related administrative tasks:
>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme



Posted on the users mailing list.