lilypond-devel
[Top][All Lists]
Advanced

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

Re: Variable argument type to music function


From: Patrick McCarty
Subject: Re: Variable argument type to music function
Date: Thu, 11 Dec 2008 19:24:58 -0800
User-agent: Mutt/1.5.18 (2008-05-17)

Hi Carl,

On Thu, Dec 11, 2008 at 08:04:32PM -0700, Carl D. Sorensen wrote:
> I'm trying to allow predefine fret diagrams to use the verbose style as well
> as the terse style.
> 
> I'd like to pass a diagram-definition to a music function that can be either
> a list or a string.  If it's a list, I'll treat the definition as a verbose
> definition.  If it's a string, I'll treat it as a terse definition.  I've
> got everything in place except for the data type check.
> 
> What kind of a type check can I use to see if a variable is a list (or pair)
> or a string?
> 
> I'm after something like:
> 
> (define-music-function (parser location key-symbol tuning shape-definition)
>    (symbol? pair? ????)
>  
> Where ??? would be the true for either a pair or a string.

There are a few custom type predicates in scm/c++.scm, but this one is
not there.  You could define a new type predicate (pair-or-string?)
modeled after these ones, I suppose.


-Patrick




reply via email to

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