[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: unpacking a list
From: |
Urs Liska |
Subject: |
Re: unpacking a list |
Date: |
Mon, 30 Nov 2015 10:35:04 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 |
Am 30.11.2015 um 10:03 schrieb David Kastrup:
> 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.
>
Oh, seems like a typical case of not seeing the forest for the trees ...
Thanks for the explanations
Urs