o dear, thunderbirds always destroys any formatting done in frescobaldi ...
here my working example as an attachment.
Am 15.02.2013 13:01, schrieb Jan-Peter Voigt:
OK, copy&paste lost a paren ... but not in the let-line, but in the
end of the whole function.
let opens a new "scope", so you start with a new block:
(let ((book #{ ... #})
(something-else 42)) ; paren closes definitions
; now do something inside this scope using the defined vars
(ly:process-book book ...)
) ; close let-block
This let block returns the value of the last statement:
writeScoreOddEven =
#(define-void-function (parser location score)
(ly:score?)
(let ((book #{ \book { \score { $score } } #}))
; process with first-number 1
(ly:output-def-set-variable! (ly:book-paper book) 'first-page-number 1)
(ly:book-process book #{ \paper {} #} #{ \layout {} #} myname)
; process with first-number 2
(ly:output-def-set-variable! (ly:book-paper book) 'first-page-number 2)
(ly:book-process book #{ \paper {} #} #{ \layout {} #} (format
"~A-even" myname))
)) ; close let *and* define-void-function
Am 15.02.2013 12:50, schrieb Urs Liska:
Am 15.02.2013 12:39, schrieb David Kastrup:
Urs Liska <[email protected]> writes:
Am 15.02.2013 12:18, schrieb Jan-Peter Voigt:
Am 15.02.2013 11:40, schrieb Urs Liska:
You can create an adhoc-book in scheme with a #{-#} construct:
writeScoreOddEven =
#(define-void-function (parser location score)
(ly:score?)
(let ((book #{ \book { \score { $score } } #}))
; process with first-number 1
Unfortunately this gives me the following error:
In procedure memoization in expression (let (book #)):
Try copy&paste. You are missing one.
Huh? I'm missing one what?
Am I right that the '(let ...' line is one statement and that the
last ')' in this line should match the one right before 'let'?
In fact I did copy&paste, the line as above is quoted from
Jan-Peter's email. But of course we're not here to blame but to solve
the problem ;-)
Your example was either missing a closing bracket or having one
opening bracket too much. But that doesn't change anything.
No, you just did not understand that
; process with first-number 1
was supposed to be replaced by the rest of the function body, depending
on what you want done.
Of course I know that (the comment line was actually from _my_ file).
Attached you see the complete file.
_______________________________________________
lilypond-user mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/lilypond-user
_______________________________________________
lilypond-user mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/lilypond-user
\version "2.16.0"
% get the current output name
myname = #(ly:parser-output-name parser)
% process a score with ly:book-process
% score - the score
writeScoreOddEven =
#(define-void-function (parser location score)
(ly:score?)
(let ((book #{ \book { \score { $score } } #}))
; process with first-number 1
(ly:output-def-set-variable! (ly:book-paper book) 'first-page-number 1)
(ly:book-process book #{ \paper {} #} #{ \layout {} #} myname)
; process with first-number 2
(ly:output-def-set-variable! (ly:book-paper book) 'first-page-number 2)
(ly:book-process book #{ \paper {} #} #{ \layout {} #} (format "~A-even" myname))
)) % close let *and* define-void-function
% Let the first page number be visible (to see the result)
\paper {
print-first-page-number = ##t
}
% Call the function
\writeScoreOddEven
\score {
\relative c'' {
c b a g c1
}
}
_______________________________________________
lilypond-user mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/lilypond-user