4 texidoc= "Test optional music function arguments.
5 The output is nonsensical, but if you wrack your brain,
6 you'll figure it out. Remember that optional arguments
7 are matched left to right, and after the first non-match,
11 \layout { ragged-right = ##t }
13 % Just like \relative, but defaulting to f as reference, making the
14 % first note of the music the same as if written as absolute pitch
16 #(define-music-function (parser location ref music)
17 ((ly:pitch? #{ f #}) ly:music?)
18 #{ \relative $ref $music #})
20 % Let's take a duration and four pitches, defaulting to 2 c' d' e'
22 #(define-music-function (parser location dur a b c d)
23 ((ly:duration? #{ 2 #}) (ly:pitch? #{ c' #})
24 (ly:pitch? #{ d' #}) (ly:pitch? #{ e' #})
25 ly:music?) #{ $a $dur $b $c ^\markup{!} $d #})
27 \new Voice { \relative c' e' \relative c' { e' } \ablative c' e' \ablative { e' }
28 \zap 8. c'' d'' {e''4..} \zap f''8 g'' \zap 4 a'' b'' c''' d'''2 }