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 anders.vin...@bek.no:
"U" == Urs Liska <u...@openlilylib.org> 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
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


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

Reply via email to