|[ << Interfaces for programmers ]||[Top][Contents][Index]||[ LilyPond Scheme interfaces >> ]|
|[ < Music function definitions ]||[ Up : Music functions ]||[ Simple substitution functions > ]|
2.3.2 Music function usage
With regard to handling the argument list, music functions don’t differ from scheme functions, Scheme function usage.
A ‘music function’ has to return an expression matching the predicate
ly:music?. This makes music function calls suitable as arguments
ly:music? for another music function call.
When using a music function call in other contexts, the context may cause further semantic restrictions.
- At the top level in a music expression a post-event is not accepted.
- When a music function (as opposed to an event function) returns an
expression of type post-event, LilyPond requires one of the named
direction indicators (
_) in order to properly integrate the post-event produced by the music function call into the surrounding expression.
- As a chord constituent. The returned expression must be of a
rhythmic-eventtype, most likely a
‘Polymorphic’ functions, like
\tweak, can be applied to
post-events, chord constituent and top level music expressions.