[plt-scheme] passing-on keyword arguments
Thanks. I may end up doing that. The downside is that I'm creating a
macro for something that "feels" like it could just be an ordinary
function.
--rob
On Tue, Mar 18, 2008 at 11:38 AM, Matthias Felleisen
<matthias at ccs.neu.edu> wrote:
>
> 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
>
>