lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 5.6.1 Substitution function syntax


From: Jean Abou Samra
Subject: Re: 5.6.1 Substitution function syntax
Date: Wed, 11 Aug 2021 20:45:49 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0



Le 11/08/2021 à 20:24, David Kastrup a écrit :
Kees van den Doel <kvdoel@gmail.com> writes:

Referring to
https://lilypond.org/doc/v2.22/Documentation/notation/substitution-function-syntax

I don't understand this sentence explanating "...music...":

normal LilyPond input, using $ (in places where only LilyPond constructs
are allowed) or # (to use it as a Scheme value or music function argument
or music inside of music >lists) to reference arguments (eg. ‘#arg1’).

The next section in the docs with examples has no example of use of '$'.
When should I use $?
In a nutshell, when # does not work.  The syntax of an expression is
decided before even looking at the value of the expression after # .  So
# in a certain place will only accept a certain type.

For example, inside of { }, an expression started with # has to be a
music expression, while $ allows expressions of type duration, pitch,
post-event and probably others, integrating/converting them in the
expected manner to music.

$ first looks at the expression's type and then decides about its
syntactic properties.  Since the LilyPond expression parser works with
lookahead for disambiguating expressions, that means that such
expressions may be evaluated earlier than expected by the user.

So generally # causes fewer syntactic surprises but is less flexible.
Also it does not copy music expressions but takes them as-is.  That can
cause a difference in some cases.


Some examples are found in

https://extending-lilypond.readthedocs.io/en/latest/lily-and-scheme.html#hash-vs-dollar



reply via email to

[Prev in Thread] Current Thread [Next in Thread]