lilypond-user
[Top][All Lists]
Advanced

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

Re: unpacking a list


From: David Kastrup
Subject: Re: unpacking a list
Date: Mon, 30 Nov 2015 10:03:33 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

Urs Liska <address@hidden> writes:

> Am 30.11.2015 um 09:27 schrieb Urs Liska:
>
> Maybe, not for having someone else do the work for me but as an
> incentive to learn:
>
> I assume I could also rewrite the following code in a similar fashion?
>
> % Produce the code for coloring one grob in a (make-music) expression
> #(define (color-element grob color)
>    (make-music
>     'ContextSpeccedMusic
>     'context-type
>     'Bottom
>     'element
>     (make-music
>      'OverrideProperty
>      'once
>      #t
>      'pop-first
>      #t
>      'grob-value
>      color
>      'grob-property-path
>      (list (quote color))
>      'symbol
>      grob)))
>
> What would that be in the newer, LilyPond-ish syntax?

Oh, #{ ... #} is not new.  It's been there since basically forever at
least for straightforward music expressions (rather than layout
definitions, markups, and other stuff).  It became more versatile around
2.14 and started to work nicely with lexical closures at a similar point
of time.

The above would roughly be

#(define (color-element grob color)
  #{ \once \override #grob . color = #color #})

Note that the default context for overrides is Bottom anyway, so you
don't need to write \override Bottom . #grob . color here.

-- 
David Kastrup



reply via email to

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