| [ << Interfaces for programmers ] | [Top][Contents][Index][ ? ] | [ LilyPond Scheme interfaces >> ] | ||
| [ < Music function definitions ] | [ Up : Music functions ] | [ Simple substitution functions > ] | ||
2.3.2 Music function usage
Music functions may currently be used in three places. Depending on where they are used, restrictions apply in order to be able to parse them unambiguously. The result a music function returns must be compatible with the context in which it is called.
- At top level in a music expression. There are no special restrictions on the argument list.
-
As a post-event. All trailing arguments of the music function with the
predicate
ly:music?will get parsed also as post-events. Note that returning post-events will also be acceptable for music functions called at top level, leading to a result roughly equivalent tos 1*0-\fun
-
As a chord constituent. All trailing arguments of the music function
with the predicate
ly:music?will get parsed also as chord constituents.
The special rules for trailing arguments make it possible to write
polymorphic functions like \tweak that can be applied to
different constructs.
There is another somewhat special rule: if you have a predicate
ly:music? directly before a ly:duration? predicate, then
the corresponding music expression must be either a music identifier, or
literal sequential or parallel music enclosed in
{…} or <<…>> explicitly.
Otherwise, Lilypond could get confused about where the music ends and
the duration starts.
| [ << Interfaces for programmers ] | [Top][Contents][Index][ ? ] | [ LilyPond Scheme interfaces >> ] | ||
| [ < Music function definitions ] | [ Up : Music functions ] | [ Simple substitution functions > ] | ||