Hello Sebastian, what do you mean with "return"? Do want to add the score immediatly or do you want to return an object containing both? You used the parser-location arguments in your scheme-function, so I guess you are using stable (2.18). I created an example for 2.18 (incomplete) and one for 2.19.82. For three possible functions.
HTH Jan-Peter Am 11.10.2018 um 10:22 schrieb Sebastian Käppler: > Hello, > > I wonder if it is possible to return markup AND score from a single > scheme function, something like this: > > example = #(define-scheme-function (parser location) () > #{ > \markup "Test" > \score { > c'4 > } > #} > ) > > I created some scripts for teaching and want to include task-markup > before each score. Using markup and my functions outside of scheme > works, but I couldn't get it to work from a single function. > > Kind regards > > > > _______________________________________________ > lilypond-user mailing list > lilypond-user@gnu.org > https://lists.gnu.org/mailman/listinfo/lilypond-user >
\version "2.19.82" % What do you want to achieve with this function? % return an object containing markup and score exampleA = #(define-scheme-function ()() ; create a (list (cons 'mup #{ \markup "Test" #}) (cons 'mus #{ \score { c'4 } #}) )) exA = \exampleA \exA.mup \exA.mus %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % add the markup and the score immediatly exampleB = #(define-scheme-function () () (add-score (list #{ \markup "Test" #})) (add-score #{ \score { c'4 } #} )) \exampleB %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % return a function that adds markup and score exampleC = #(define-scheme-function (mup mus) (markup? ly:score?) (define-void-function ()() (add-score (list mup)) (add-score mus) )) exC = \exampleC Test \score { c'4 } \exC
\version "2.18.2" % What do you want to achieve with this function? % return an object containing markup and score exampleA = #(define-scheme-function (parser location) () ; create a (list (cons 'mup #{ \markup "Test" #}) (cons 'mus #{ \score { c'4 } #}) )) exA = \exampleA % this is much nicer in 2.19.82 ... $(ly:assoc-get 'mup exA) $(ly:assoc-get 'mus exA) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % add the markup and the score immediatly exampleB = #(define-scheme-function (parser location) () (add-score (ly:parser-clone parser) (list #{ \markup "Test" #})) (add-score (ly:parser-clone parser) #{ \score { c'4 } #} )) \exampleB %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % return a function that adds markup and score exampleC = #(define-scheme-function (parser location) () (define-void-function (parser location)() (add-score (ly:parser-clone parser) (list #{ \markup "Test" #})) (add-score (ly:parser-clone parser) #{ \score { c'4 } #} ))) exC = \exampleC \exC
_______________________________________________ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user