On 12 November 2012 21:54, Daniel Llorens <daniel.llor...@bluewin.ch> wrote: > > (define f > (case-lambda* > ((a b c #:key x) 3) > ((a #:key x) 1))) > > scheme@(guile-user)> (g 0 #:x 1) > $1 = 3
Because “0 #:x 1” is a valid match for “a b c”, you should rearrange the case-lambda clauses. When the doc. states keyword arguments do not contribute to the success of a match, it refers only to keyword arguments in the case-lambda clause, not at the call site. This makes sense, otherwise it would inhibit writing functions that detect keywords internally from their rest arguments. scheme@(guile-user)> (define g (case-lambda* ((a #:key x) 1) ((a b c #:key x) 3))) scheme@(guile-user)> (g 0 #:x 1) $2 = 1 However, trying to call with three arguments then triggers an error, and I am not sure why: scheme@(guile-user)> (g 1 2 3) <unnamed port>:46:1: In procedure g: <unnamed port>:46:1: In procedure #<procedure g (a #:key x) | (a b c #:key x)>: Invalid keyword Entering a new prompt. Type `,bt' for a backtrace or `,q' to continue. scheme@(guile-user) [1]> ,bt In current input: 46:1 0 (g 1 #<undefined> 2 3) Definitely you need to rearrange the clauses. About this error, I don't know! Regards