|
From: | Jean Abou Samra |
Subject: | Re: 2.25.2 optional fine endings |
Date: | Mon, 13 Mar 2023 21:25:06 +0100 |
User-agent: | Evolution 3.46.4 (3.46.4-1.fc37) |
Le lundi 13 mars 2023 à 13:04 -0700, Paul Scott a écrit :
I've read your wonderful scheme documentation. I'm still struggling to make sense of Aaron's simple code
\fixed c' {
c1
\set Score.repeatCommands = #((volta ,voltaFine)) c4 d c2 \bar "|." \set Score.repeatCommands = #
((volta #f) (volta ,voltaCont))
f4 g a b
\set Score.repeatCommands = #'((volta #f))
}I'm extremely familiar with a number of programming languages including Forth. If one of you could say more about what the line:
\set Score.repeatCommands = #`((volta #f) (volta ,voltaCont))
does and how it relates with\set Score.repeatCommands = #(list(list 'volta voltaCont))
I might be able to go farther.
TIA for any more help with this,
The format of repeatCommands
is a list where each element is itself a list. The first element of each sublist (element of the main list) is a "command", namely a symbol, which can be volta
, start-repeat
or end-repeat
.
If the command is volta
, LilyPond expects one remaining element in the sublist, which can be
#f
(the boolean false), to end a volta bracket previously started with the first form.If the command is start-repeat
, it prints a start repeat bar line.
If the command is end-repeat
, it prints an end repeat bar line.
The _expression_
#(list (list 'volta voltaCont))
uses the list
function to create a list with one element inside. That element is (list 'volta voltaCont)
, which is itself a list with two elements, 'volta
and voltaCont
. The first element is a quoted symbol, so it's not evaluated and remains as a symbol. The second element is also a symbol but without a quote. Since symbols are not self-evaluating, but evaluate by looking up variables, this reads the value of the voltaCont
variable. So you have
list
| list element 1:
| list
| list element 1: the symbol volta
| list element 2: the markup contained in the variable voltaCont
which matches the form for a repeatCommands with one command, "volta", starting a volta bracket with the text contained in the variable "voltaCont".
The _expression_
#`((volta #f) (volta ,voltaCont))
is a quasiquote. Since a quasiquote is “almost a quote”, it means that Scheme looks literally at what _expression_ you have entered, rather than evaluating it. Because of the parentheses, it's a list. That list contains two sublists. The first one is (volta #f)
. Again, it's quoted, so it's not evaluated. (If it were evaluated, it would look up the function “volta” and apply it to the boolean #f
.) That list is made of the symbol volta
and the boolean #f
.
The second sublist is (volta ,voltaCont)
. Again, it's quoted, so not evaluated. The first element is volta
, a symbol. The second element has an unquote on it (the comma), so it does get evaluated. It's a symbol, voltaCont
, and symbols evaluate by looking up variables, so it gets the value of voltaCont
and inserts that markup into the sublist.
The result is
list
| list element 1:
| list:
| | list element 1: the symbol volta
| | list element 2: the boolean #f
| list element 2:
| list:
| | list element 1: the symbol volta
| | list element 2: the markup contained in the variable voltaCont
and it matches the format of repeatCommands
for two commands: ending a previously started volta (the first element) and starting a new one (the second element).
Did it help to read it very verbosely like this?
signature.asc
Description: This is a digitally signed message part
[Prev in Thread] | Current Thread | [Next in Thread] |