lilypond-devel
[Top][All Lists]
Advanced

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

Re: Make accidental styles available as context mods. (issue 4819064)


From: David Kastrup
Subject: Re: Make accidental styles available as context mods. (issue 4819064)
Date: Tue, 06 Sep 2011 18:32:42 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

Reinhold Kainhofer <address@hidden> 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




reply via email to

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