[ << 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
of type 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 (
-
,^
, and_
) 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-event
type, most likely aNoteEvent
.
‘Polymorphic’ functions, like \tweak
, can be applied to
post-events, chord constituent and top level music expressions.