lilypond-user
[Top][All Lists]
Advanced

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

Re: Colors in alists


From: Urs Liska
Subject: Re: Colors in alists
Date: Wed, 05 Nov 2014 10:18:03 +0100
User-agent: Mozilla/5.0 (X11; Linux i686; rv:24.0) Gecko/20100101 Thunderbird/24.6.0

Hi all who replied (I'm just writing this once and mean all),

thank you for your interesting approaches. In the end I'll stick with Jay's suggestion. It's slightly awkward when defining the alist, but it seems to me more efficient when retrieving the element. The alist is defined only once when the file is included but the colors are retrieved each time the function is called.

Best and thanks
Urs

Am 05.11.2014 10:08, schrieb address@hidden:
"U" == Urs Liska <address@hidden> writes:
     U> I want to store colors in an alist like
     U> #(define types
     U>   '(("one" . "red")
     U>     ("two" . "blue")))

     U> I can retrieve and display the values with assoc-ref but I don't
     U> know how to turn the returned string into a color to be used in
     U> an override.

Here's another approach, not fuzzing with the structure (assoc-list) you
set up.

#(define types-strings
   '(("one" . "red")
     ("two" . "blue")))

#(display (eval-string (assoc-ref types-strings "one")))

Perhaps a more 'schemish' one - just storing pointers:

#(define types-symbols
   '((one . red)
     (two . blue)))

#(display (eval (assoc-ref types-symbols 'two) (interaction-environment)))

-naders


_______________________________________________
lilypond-user mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/lilypond-user




reply via email to

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