[Top][All Lists]

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

Add \eval to Lilypond?

From: Alan Stern
Subject: Add \eval to Lilypond?
Date: Fri, 3 Mar 2006 20:24:37 +0000 (UTC)
User-agent: Loom/3.14 (

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 } " "")

Then the setting of the single variable OutputMidi would control
whether or not the \midi block was parsed and hence whether a MIDI
output file was created.   Currently there's no way to make such a
decision at runtime.  Much more complicated code could easily be
constructed, in which the strings are calculated and assembled

This ought to be reasonably simple to implement for someone who is
already familiar with Lilypond's internal operation (which I am not).
Is anyone interested?

Alan Stern

reply via email to

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