This page is part of the web mail archives of SRFI 89 from before July 7th, 2015. The new archives for SRFI 89 contain all messages, not just those from before July 7th, 2015.
* From: Marc Feeley <email@example.com> | This is the behaviour specified by DSSSL and the example is correct (the | first value given for parameter "k" has precedence over the second value | given). The ability to provide the value of a named parameter more than once | is useful for implementing wrapper functions that override the default value | of a named parameter. Here's a simple example: | (define (debug f) (lambda args (apply f (append args (list debug: #t))))) | (define (foo x y #!key (debug #f) (port (current-output-port))) (if debug (display "foo\n" port)) (display (string-append "x+y=" (number->string (+ x y)) "\n") port)) | (define (bar x #!key (debug #f) (port (current-output-port))) (if debug (display "bar\n" port)) (display (string-append "log(x)=" (number->string (log x)) "\n") port)) | (define dfoo (debug foo)) | (define dbar (debug bar)) > (foo 1 2) | x+y=3 > (foo 1 2 debug: #t) | foo | x+y=3 > (dfoo 1 2) | foo | x+y=3 > (dfoo 1 2 debug: #f) | x+y=3 > (dfoo 1 2 unknown-param: #f) | *** ERROR -- Unknown keyword argument passed to procedure | (foo 1 2 unknown-param: #f debug: #t) I think it is better that foo has rest parameter to consume the redundant arguments even if the rest parameter is not used in the definition of the procedure. Even though it has rest parameter, such a function is possible. And it seems to be a more clear syntax. -- Joo ChurlSoo