lilypond-user
[Top][All Lists]
Advanced

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

Optional arguments


From: Paul Morris
Subject: Optional arguments
Date: Thu, 6 Mar 2014 11:58:28 -0800 (PST)

Hello all,
I have a question about how to use optional arguments in scheme functions. 
In my tiny example below I want to be able to leave out the 3rd argument,
but then LilyPond takes the 2nd \makeScore as the 3rd argument (which
doesn't work).  I'm just curious to learn how to do this assuming there is a
way.  I can always just enter "" or \default for the 3rd argument (but then
is it really optional?).

Relevant docs:
http://lilypond.org/doc/v2.19/Documentation/extending/scheme-function-definitions

Thanks,
-Paul


\version "2.19.2"

TuneA = { c'1 }
TuneB = { g'1 }

makeScore =
#(define-scheme-function
  (parser location melody title composer)
  (ly:music? string? (string? ""))
  #{
    \score {
      \new Staff {
        #melody
      }
      \header {
        piece = #title
        opus = #composer
      }
    }
  #})

\bookpart {

  \makeScore
  \TuneA
  "TuneA"
  % needs either of these as 3rd (optional?) argument to work
  % ""
  % \default 

  \makeScore
  \TuneB
  "TuneB"
  "ComposerB"
}



--
View this message in context: 
http://lilypond.1069038.n5.nabble.com/Optional-arguments-tp160187.html
Sent from the User mailing list archive at Nabble.com.



reply via email to

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