[plt-scheme] passing-on keyword arguments

From: Rob Hunter (rob.hunter at gmail.com)
Date: Tue Mar 18 13:36:10 EDT 2008

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?


Posted on the users mailing list.