[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: scheme function generating multiple score
From: |
Timothy Lanfear |
Subject: |
Re: scheme function generating multiple score |
Date: |
Fri, 29 Dec 2017 10:26:14 +0000 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 |
On 29/12/17 07:03, Gianmaria Lari wrote:
Sorry to bother but I'm unable to get out from this problem.
This code generate two scores:
\version "2.19.80"
\score {
\transpose c d {c' d' e'}
\layout{}
}
\score {
\transpose c e {c' d' e'}
\layout{}
}
I tried to write a scheme function doing something similar:
\version "2.19.80"
myScore = #(define-scheme-function (music) (ly:music?) #{
\score {
\transpose c d $music
\layout{}
}
\score {
\transpose c e $music
\layout{}
}
#})
\myScore {c' d' e'}
but when I try to compile I get this error
error: syntax error, unexpected \score, expecting end of input
\score {
error: error in #{ ... #}
Any suggestion?
Thank you, Gianmaria
A function can only return a single item so you could wrap the two
scores in a book and then process the book.
\version "2.19.80"
myBook = #(define-scheme-function (music) (ly:music?) #{
\book {
\score { \transpose c d $music \layout{} }
\score { \transpose c e $music \layout{} }
}
#})
mybook = #(myBook #{ { c' d' e' } #})
\mybook
--
Timothy Lanfear, Bristol, UK.