On 2018-06-04 08:54, David Sumbler wrote:
In my efforts (largely successful) to find a way easily to control
conditional compilation, I came across this apparent anomaly.
The following two short examples work as one might expect:
%%%%%
\book {
\score { g }
}
%%%%%
%%%%%
var =
\book {
\score { g }
}
\var
%%%%%
Adding a \bookpart to the first also works as expected:
%%%%%
\book {
\bookpart {
\score { g }
}
}
%%%%%
But putting this into a variable thus:
%%%%%
var =
\book {
\bookpart {
\score { g }
}
}
\var
%%%%%
causes parsing errors.
For my better understanding of how LilyPond works, can somebody explain
to me why this happens?
David
I tried a few more permutations and found you can do this:
%%%%
\version "2.19.81"
varOne = \bookpart { \score { g } }
varTwo = \book { \varOne }
\varTwo
%%%%
But going back to your original code, given the output from lilypond...
GNU LilyPond 2.19.81
Processing `bookpartvar.ly'
Parsing.../usr/local/lilypond/usr/share/lilypond/current/scm/lily-library.scm:243:5:
In procedure ly:book-process in expression (process-procedure book
paper ...):
/usr/local/lilypond/usr/share/lilypond/current/scm/lily-library.scm:243:5:
Wrong type (expecting real number): #<undefined>
...here are the lines leading up to and including 243 from
lily-library.scm:
%%%%
(define (print-book-with book process-procedure)
(let* ((paper (ly:parser-lookup '$defaultpaper))
(layout (ly:parser-lookup '$defaultlayout))
(outfile-name (get-outfile-name book)))
(process-procedure book paper layout outfile-name)))
%%%%
It would seem there is a problem with the so-called "default paper".
That led me to try this:
%%%%
\version "2.19.81"
var = \book { \bookpart { \paper {} \score { g } } }
\var
%%%%
And that compiles.
-- Aaron Hill
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user