[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Issue 3918: Add \alternatingTimeSignatures (issue 97110045)

From: Thomas Morley
Subject: Re: Issue 3918: Add \alternatingTimeSignatures (issue 97110045)
Date: Wed, 4 Jun 2014 00:59:58 +0200

2014-06-01 18:45 GMT+02:00 Paul Morris <address@hidden>:
> 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))) "")

    (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))

m = { c''1 }

\test ##f \m
\test #3 \m
\test #(lambda (a) a) \m


reply via email to

[Prev in Thread] Current Thread [Next in Thread]