Extending LilyPond: 2.3.2 Music function usage

### 2.3.2 Music 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 a `NoteEvent`.

‘Polymorphic’ functions, like `\tweak`, can be applied to post-events, chord constituent and top level music expressions.

#### LilyPond — Extending v2.22.2 (stable-branch).