\version "2.11.39" \header { title = "Scores generated by Scheme" piece = "Scheme scores" } testmusic = {\clef bass { d4 }} teststaff = \new Staff << \testmusic >> testPieceName = "Lilypond test score" othermusic = {\clef tenor { 2 }} otherstaff = \new Staff << \othermusic >> otherPieceName = "Lilypond other score" anothermusic = {\clef treble { c8[ g] }} anotherstaff = \new Staff << \anothermusic >> anotherPieceName = "another score" % This is classical lilypond style, one variable per score (awkward % if you have hundreds of combinations, which all look the same, % except for the variable names, which follow a certain pattern): % definitions in some included file, needs to be done over and over again... lytestscore = \score { \teststaff \header { piece = \testPieceName } } lyotherscore = \score { \otherstaff \header { piece = \otherPieceName } } % actual inclusion in each instrument's file: \score { \lytestscore } \score { \lyotherscore } % Now, how do I do that in scheme???? % This works, but it seems I'm unable to put the whole scheme expression % into a separate function, so that it can be called with \createscore args % instead of the scheme #(createscore arg): #(define (createscore name) (ly:export (ly:make-score (primitive-eval (string->symbol (string-append name "staff"))) ) ) ) \score { #(createscore "test") } \score { #(createscore "other") } % This does NOT work (error message: "syntax error, unexpected SCM_IDENTIFIER") \score { \createscore #"test"} % Neither does this (simply no effect whatsoever... #(createscore "another") % But now my real problem: How do I set the 'header:piece property % only for that score? I.e. extend it to produce the equivelant of: % % testscore = \score { % \teststaff % \header { piece = \testPieceName } % } #(define (createscoreI name) (let ( ( thisscr (ly:make-score (primitive-eval (string->symbol (string-append name "staff"))) ) )) ; All of these attempts fail (prob-set-property needs a prob..., context-set-propert does not work, either) ; (ly:prob-set-property! thisscr 'header:piece "test piece") ; (ly:prob-set-property! (ly:export thisscr) 'header:piece "test piece") ; (ly:context-set-property! thisscr 'header:piece "test piece") (ly:export thisscr) ) ) \score { #(createscoreI "test") } \score { #(createscoreI "other") }