[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Scheme optional arguments, number-list
From: |
David Kastrup |
Subject: |
Re: Scheme optional arguments, number-list |
Date: |
Sat, 23 Apr 2016 21:30:32 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux) |
Mark Knoop <address@hidden> writes:
> In this instance single number lists are not relevant anyway. So I've
> tried this method:
>
> #(define (multi-number-list? x)
> (and (list? x)
> (< 1 (length x))
> (every number? x)))
>
> testfn = #(define-void-function
> (a) (multi-number-list?)
> (print "\na=~s length=~s\n" a (length a)))
>
> {
> % this works
> \testfn #'(1 2 3)
> % this doesn't - why?
> \testfn 1,2,3
> % this fails as expected
> \testfn 1
> }
>
> ...and was surprised to see that the new list syntax doesn't work in
> this instance. It's not clear to me at what point lilypond/guile
> decides that something is a list or not.
LilyPond does not try for a list if a single-element list does not work.
Because that decision would result in lookahead which is something it
cannot do in the context of optional arguments. It needs to make a
decision earlier than that.
So, uh, my advice was not particularly useful.
Sorry for that.
--
David Kastrup