Aaron Hill <lilyp...@hillvisions.com> writes: > On 2018-05-11 14:17, David Kastrup wrote: >> Aaron Hill <lilyp...@hillvisions.com> writes: >>> The error message reads pretty clearly, though. The result of a music >>> function cannot be a single NOTENAME_PITCH. >> >> The result of a music function cannot be a pitch, period. It has to be >> a music expression. A pitch is not a music expression. > > I think we are in violent agreement here. It is going to be pointless > to nitpick details that are likely irrelevant and off-topic. So in an > effort to circle back to summarize and address the original > question... > > A music function must evaluate to a music expression. > > The reason why #{ $p #} does not work as the body of a music function > is that it will only evaluate to a pitch not a note, and that pitch by > itself is not enough to create a music expression.
Wrong again. There is no such thing as a "pitch by itself" in Scheme. A pitch is not a deficient music expression, rather it is not a music expression at all. It's like saying a character by itself is not enough to create a string, as if two characters by itself would create a string. Strings are not the same as characters of any count. Strings are a separate data structure from characters. You can place characters in other data structures. You can certainly also form one-character strings. (make-music 'NoteEvent 'pitch #{ c' #}) is a music expression a music function can return (it's deficient for a number of unchanged uses in that it is lacking a duration but you can add durations afterwards if you want to with different music functions). Two pitches are not enough to create a music expression. Ten pitches aren't. If you want to create a music expression, you need to create a music expression, like using make-music. Or use some #{ ... #} construct recognized as producing music. > #{ $p 4 #} works because a pitch followed by a duration clearly > defines a note, which is enough to form a music expression. #{ $p #} #{ 4 #} is a pitch followed by a duration and does not form a music expression. The music expression is created by specific forms of the #{ ... #} syntax. -- David Kastrup _______________________________________________ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user