Re: case-lambda* question

2013-01-15 Thread Daniel Llorens
On Jan 14, 2013, at 11:39, Andy Wingo wrote: … > The attached patch fixes the problem. If there are no comments against > it, I will apply it to stable-2.0. It does introduce a slight > incompatibility, but I don't think there are many case-lambda* users, > and it makes cases work that previou

Re: case-lambda* question

2013-01-14 Thread Ludovic Courtès
Hi! Andy Wingo skribis: > So, the story here is fairly simple, but the result is complicated. Woow, thanks for the clear and thorough explanation! [...] > Again, considering the first clause: > > ((lambda* (a #:key x) 3) 1 2 3) > > Does it apply? It shouldn't: there are three positional

Re: case-lambda* question

2013-01-14 Thread Andy Wingo
Hi Daniel, On Mon 12 Nov 2012 14:54, Daniel Llorens writes: > (define f > (case-lambda* > ((a b c #:key x) 3) > ((a #:key x) 1))) > > scheme@(guile-user)> (g 0 #:x 1) > $1 = 3 > > The manual says > >> Also, for completeness. Guile defines case-lambda* as well, w

Re: case-lambda* question

2013-01-14 Thread Andy Wingo
On Thu 15 Nov 2012 02:01, Germán "A. Arias" writes: > /home/german/Escritorio/./test.scm:3:10: In procedure # #:optional y) | (x #:key y) | (x y #:key z)>: Odd length of keyword > argument list > > But there is one interest line > > 3: 0 [f 1 # 2 #:z 3] > > What mean this? That is taking the seco

Re: case-lambda* question

2013-01-14 Thread Andy Wingo
On Wed 14 Nov 2012 11:20, Daniel Llorens writes: > (pass-if "case-lambda*" >(null? (call-with-warnings > (lambda () > (compile '(let ((f (case-lambda* >((x #:optional y) 1) >(

Re: case-lambda* question

2012-11-19 Thread Daniel Llorens
On Nov 15, 2012, at 02:22, Daniel Hartwig wrote: > On 14 November 2012 18:20, Daniel Llorens wrote: >>> 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 sen

Re: case-lambda* question

2012-11-14 Thread Daniel Hartwig
On 14 November 2012 18:20, Daniel Llorens wrote: >> 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

Re: case-lambda* question

2012-11-14 Thread A. Arias
Running this. (define f (case-lambda* ((x #:optional y) 1) ((x #:key y) 2) ((x y #:key z)3))) (f 1 2) (f #:y 2) (f 1 2 #:z 3) I get. Backtrace: In ice-9/boot-9.scm: 157: 7 [catch #t # ...] In unknown file: ?: 6 [apply-smob/1 #] In ice

Re: case-lambda* question

2012-11-14 Thread A. Arias
El mié, 14-11-2012 a las 11:20 +0100, Daniel Llorens escribió: > > Is this the test? > > (pass-if "case-lambda*" >(null? (call-with-warnings > (lambda () > (compile '(let ((f (case-lambda* >((x #:optional y) 1) >

Re: case-lambda* question

2012-11-14 Thread Daniel Llorens
On Nov 13, 2012, at 03:46, Daniel Hartwig wrote: > On 12 November 2012 21:54, Daniel Llorens 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 val

Re: case-lambda* question

2012-11-13 Thread A. Arias
El mar, 13-11-2012 a las 10:46 +0800, Daniel Hartwig escribió: > > However, trying to call with three arguments then triggers an error, > and I am not sure why: > > scheme@(guile-user)> (g 1 2 3) > :46:1: In procedure g: > :46:1: In procedure # #:key x)>: Invalid keyword > > Entering a new promp

Re: case-lambda* question

2012-11-12 Thread Daniel Hartwig
On 12 November 2012 21:54, Daniel Llorens 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 claus

case-lambda* question

2012-11-12 Thread Daniel Llorens
(define f (case-lambda* ((a b c #:key x) 3) ((a #:key x) 1))) scheme@(guile-user)> (g 0 #:x 1) $1 = 3 The manual says > Also, for completeness. Guile defines case-lambda* as well, which is like > case-lambda, except with lambda* clauses. A case-lambda* c