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: Reinhold Kainhofer
Subject: Re: Make accidental styles available as context mods. (issue 4819064)
Date: Mon, 5 Sep 2011 23:22:26 +0200
User-agent: KMail/1.13.6 (Linux/2.6.38-11-generic; KDE/4.7.0; i686; ; )

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???
       }
    #})

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.


And the other direction (creating the context mod first and then adding 
individual modifications to that object) is also not straightforward scheme 
syntax:

  (let* ((context-mod #{ \with {} #}))
     (ly:add-context-mod context-mod your-new-entry))

is harder to understand than
  (let* ((context-mod (ly:make-context-mod (list your-new-entry)))

or 
  (let* ((context-mod (ly:make-context-mod)))
      (ly:add-context-mod context-mod your-new-entry))


> So "directly in Scheme" is a mischaracterization,

Sorry for being imprecise. What I meant was "directly in Scheme syntax".

Cheers,
Reinhold
-- 
------------------------------------------------------------------
Reinhold Kainhofer, address@hidden, http://reinhold.kainhofer.com/
 * Financial & Actuarial Math., Vienna Univ. of Technology, Austria
 * http://www.fam.tuwien.ac.at/, DVR: 0005886
 * LilyPond, Music typesetting, http://www.lilypond.org



reply via email to

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