lilypond-user
[Top][All Lists]
Advanced

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

Re: Colors in alists


From: anders . vinjar
Subject: Re: Colors in alists
Date: Wed, 05 Nov 2014 10:08:15 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

>>>>> "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




reply via email to

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