Is it possible to define functions that generate music functions
in Lilypond?  I'm looking something to this effect:

-----
\version "2.12.3"

musicA = #(define-music-function (parser location music)
                                 (ly:music?)
           #{ c4 d e f $music #})

\musicA { g4 a b a }

% makeMusicFn = #(define-music-function (parser location prepend-music)
%                                       (ly:music?)
%                 (define-music-function (parser location append-music)
%                                        (ly:music?)
%                  #{ $prepend-music $append-music #}))
%
% musicB = \makeMusicFn { c4 d e f }
% 
% \musicB { g4 a b a }
-----

Here expressions "\musicA { g4 a b a }" and "\musicB { g4 a b a }"
should evaluate to same music expression, that is
{ c4 d e f g4 a b a }.  The expressions that are commented out are
attempts to achieve what I'm looking for.  The above syntax is,
however, wrong, as define-music-function must return a music
expression, not a function.

Any ideas?

Juha

_______________________________________________
lilypond-user mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to