[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Colors in alists
From: |
R. Mattes |
Subject: |
Re: Colors in alists |
Date: |
Tue, 4 Nov 2014 16:16:10 +0100 |
On Tue, 04 Nov 2014 12:18:33 +0100, Urs Liska wrote
> Am 4. November 2014 12:01:22 MEZ, schrieb Marc Hohl <address@hidden>:
> >Am 04.11.2014 um 11:48 schrieb Urs Liska:
> >> I want to store colors in an alist like
> >>
> >> #(define types
> >> '(("one" . "red")
> >> ("two" . "blue")))
> >>
> >> I can retrieve and display the values with assoc-ref but I don't know
> >> how to turn the returned string into a color to be used in an
> >override.
> >
> >Untested: maybe you store the color as a symbol, or use string->symbol?
>
> Unfortunately not.
> Type check for `color' failed; value `(quote darkgreen)' must be of
> type `color'
Classic layer 8 error :-)
You're not storing a symbol, you are storing a list in the cdr of the
assoc. Hint:
'(("one" . 'red)
("two" . 'blue))
Quotes the entire list, and "'x" is a syntactic shortcut to "(quote x)",
so your list evaluates to:
(list (cons "one" (quote red))
(cons "two" (quote blue)))
Write
'(("one" . red)
("two" . blue))
if you want symbols as the values of the assoc.
HTH Ralf Mattes
--
R. Mattes -
Hochschule fuer Musik Freiburg
address@hidden
Re: Colors in alists, Jay Anderson, 2014/11/04
Re: Colors in alists, Paul Morris, 2014/11/04
Re: Colors in alists, anders . vinjar, 2014/11/05