On 29 December 2017 at 12:28, Gianmaria Lari <gianmarial...@gmail.com> wrote:
> > > On 29 December 2017 at 11:26, Timothy Lanfear <timo...@lanfear.me> wrote: > >> 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. >> >> >> _______________________________________________ >> lilypond-user mailing list >> lilypond-user@gnu.org >> https://lists.gnu.org/mailman/listinfo/lilypond-user >> > > oh, great! It was some weeks I was stuck with this issue. I thought the > scheme function would simply copy everything inside the #{ ... #} replacing > the variable. > > Thanks a lot Timothy! > Is it possible to avoid the two lines mybook = #(myBook #{ { c' d' e' } #}) \mybook and write directly something like .... myBook #{ { c' d' e' } #} ?
_______________________________________________ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user