lilypond-devel
[Top][All Lists]
Advanced

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

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


From: Paul Morris
Subject: Re: Issue 3918: Add \alternatingTimeSignatures (issue 97110045)
Date: Sat, 7 Jun 2014 07:39:06 -0700 (PDT)

Thomas Morley-2 wrote
> No.
> It abuses the syntax for an _optional_ argument, with the default ""

Ah, I see.  Thanks for the explanation and example.  I see that if you don't
use the (predicate? default) form for supplying an optional/default argument
then you get an error: Unbound variable "x"

So I suppose that currently the preferred way to use a new type predicate
combination (when you want one that has not been predefined) would be as
follows.

Cheers,
-Paul


\version "2.18.2"

#(define (markup-or-stencil-or-procedure-or-false? x)
   (or
    (markup? x)
    (ly:stencil? x)
    (procedure? x)
    (and (boolean? x) (not x))))

substitute =
#(define-music-function (parser location new-stl item)
   (markup-or-stencil-or-procedure-or-false?
    symbol-list-or-music?)
   #{
     \tweak stencil
     #(if (markup? new-stl)
          (lambda (item) (grob-interpret-markup item new-stl))
          new-stl)
     #item
   #})

%%%%%%%%%%%%%%%%%%%%%

{
  c'1
  \once \substitute \markup "x" Staff.NoteHead
  d'1
  \once \substitute #(make-circle-stencil  0.5 0.1 #t) Staff.NoteHead
  e'1
  \once \substitute ##f Staff.NoteHead
  g'1
  \once \substitute
  #(lambda (grob)
     ;; just an example procedure
     (display grob)(newline)
     #f)
  Staff.NoteHead
  a'1
}



--
View this message in context: 
http://lilypond.1069038.n5.nabble.com/Re-Issue-3918-Add-alternatingTimeSignatures-issue-97110045-tp162462p163092.html
Sent from the Dev mailing list archive at Nabble.com.



reply via email to

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