Citerar Alan Stern <[EMAIL PROTECTED]>:
> The facility for generating Lilypond code from within Scheme is
> fairly limited. The #{ ... #} syntax only recognizes music
> expressions, so it can't be used in a \layout block, for instance.
>
> Is it possible to add a \eval primitive to Lilypond? It could
> take as an argument either a literal string or a Scheme expression
> that returns a string, and then it would feed the contents of that
> string directly into the parser.
>
> As an example, we could put in a source file
>
> \eval #(if OutputMidi "\\midi { \\tempo 4 = 120 } " "")
Sounds like what you're looking for is a preprocessor. There will never be a
builtin preprocessor in lilypond, but you are free to use an external one if
you like (e.g. m4, gpp).
For music expressions, you could define an 'apply' music function:
apply = #(def-music-function (parser location statement music) (procedure?
ly:music?)
(let ((ls (ly:music-property music 'elements)))
(statement ls)))
\apply #(lambda (x) (if (eq? 1 0) (car x) (cadr x))) { {c' d'} {e' f'} }
=> {e' f'}
Erik
_______________________________________________
lilypond-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/lilypond-devel