[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Colors in alists
From: |
Paul Morris |
Subject: |
Re: Colors in alists |
Date: |
Tue, 4 Nov 2014 10:17:51 -0800 (PST) |
Jay Anderson wrote
> Try quasiquote + unquote:
>
> #(define types
> `(("one" . ,red)
> ("two" . ,blue)))
>
> #(display types) => ((one 1.0 0.0 0.0) (two 0.0 0.0 1.0))
>
> -----Jay
That does it, or you can use "list" and "cons". Allow me to provide a tiny
example:
%%%%%%%%%%%%%%%%%%%%%
\version "2.18.2"
#(define types
`(("one" . ,red)
("two" . ,blue)))
#(define typesB
(list
(cons "one" red)
(cons "two" blue)))
#(display (color? (assoc-ref types "one")))
#(newline)
#(display (color? (assoc-ref typesB "one")))
%%%%%%%%%%%%%%%%%%%%%
This displays:
#t
#t
With either of these the red and blue are not quoted which seems to have
been the problem before.
-Paul
--
View this message in context:
http://lilypond.1069038.n5.nabble.com/Colors-in-alists-tp168384p168405.html
Sent from the User mailing list archive at Nabble.com.
Re: Colors in alists, Jay Anderson, 2014/11/04
Re: Colors in alists,
Paul Morris <=
Re: Colors in alists, anders . vinjar, 2014/11/05