I have some general questions regarding calling a scheme function which I will ask using the following example code (which gives no errors and produces an output pdf):
\version "2.20.0"
pageSong =
#(define-scheme-function
(title music)
(string? ly:music?)
#{
\bookpart {
\header {
title = $title
}
\score {
$music
\layout {}
}
}
#})
title = "myTitle"
music = { { c' c' c' c'} \addlyrics { one two three four }}
foo = 1
$(pageSong title music)
If I remove the line
foo = 1
, I will get a compilation error sayingUnbound variable: music
. Why? And why does it not occur when I have that line?If I replace
$
by#
, no error occurs (even if thefoo = 1
line is missing), but no output is created either. Why?This says:
You call a scheme function from LilyPond by writing its name preceded by \, followed by its arguments.
But writing \pageSong \title \music
or \pageSong $title $music
or \pageSong title music
gives the error message bad expression type
during compilation. So what is the correct syntax that was meant in the linked source?