On 12/15/10 9:29 AM, "Juha Erkkila" <j...@turnipsi.no-ip.org> wrote:
> 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.
Music functions must return music expressions, but scheme functions can
return functions.
Are you after this specific behavior, or some other behavior, of which this
is a simplified example?
Thanks,
Carl
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user