lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: scheme function generating multiple score


From: Gianmaria Lari
Subject: Re: scheme function generating multiple score
Date: Fri, 29 Dec 2017 12:28:55 +0100



On 29 December 2017 at 11:26, Timothy Lanfear <address@hidden> 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
address@hidden
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!

reply via email to

[Prev in Thread] Current Thread [Next in Thread]