2014-06-01 18:45 GMT+02:00 Paul Morris <p...@paulwmorris.com>: > Paul Morris wrote >> #(define-music-function (parser location arg) >> (or (boolean?) (number?) (procedure?)) >> ...) > > I suppose it would need to be something like this to work for multiple > arguments: > > #(define-music-function (parser location argA argB) > ((or boolean? number? procedure?) > pair?) > ...) > > Anyway, you can see the idea despite my fumbling with the syntax. > > -Paul
Hi Paul, in general I disagree. Nearly every time I thought I'd need a predicate for multiple argument-types, I found a way to code it better/simpler. OTOH, we have already the most general `scheme?'-predicate. You can use it first and sort the argument-types later. And really hackish is: test = #(define-music-function (parser location test-arg mus) ( ;very bad, kludgy and hacky, though valid: ((lambda (x) (or (boolean? x) (number? x) (procedure? x))) "") ;scheme? ly:music? ) (cond ((boolean? test-arg) (format #t "\n~a is a boolean." test-arg)) ((number? test-arg) (format #t "\n~a is a number." test-arg)) ((procedure? test-arg) (format #t "\n~a is a procedure." test-arg)) (else #f)) mus) m = { c''1 } \test ##f \m \test #3 \m \test #(lambda (a) a) \m Cheers, Harm _______________________________________________ lilypond-devel mailing list lilypond-devel@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-devel