Reinhold Kainhofer <reinh...@kainhofer.com> writes: > Am Montag, 5. September 2011, 23:02:11 schrieb David Kastrup: >> #{..#} _is_ a direct Scheme construct interpreted at _read_ time in the >> Scheme reader. It is enabled in scm/parser-ly-from-scheme.scm with the >> line (read-hash-extend #\{ read-lily-expression). >> >> Within Lilypond, there is no place where you can read Scheme source but >> not a #{...#} construct except in the load order before >> scm/parser-ly-from-scheme.scm. > > Actually, what I meant was that sometimes you are writing a scheme > function, and you are constructing context mods in scheme. If you > already have a list of context mod entries, how can you create the > context mod? > > > (let* ((mod-entries (map create-mod-from-something your-list))) > #{ > \with { > % What comes here to turn the scheme list mod-entries into > % context mod??? > } > #})
(let ((mod-entries (map create-mod-from-something your-list))) (reduce-right (lambda (a b) #{ \with { $b $a } #}) #{\with{}#} your-list)) > Also, this creates a snippet in lilypon syntax from an existing scheme > list, just to have it parsed and the exact list created again by the > parser. So, that's not very efficient. I actually did not realize that evaluating the expression ran the parser at runtime (as opposed to meddling with $-replacements happening at compile time). -- David Kastrup _______________________________________________ lilypond-devel mailing list lilypond-devel@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-devel