On Wed, Mar 24, 2010 at 5:43 PM, WoodHacker <ramsa...@comcast.net> wrote:

> Actually, swap! doesn't seem to work in my case.    I should state
> what I'm
> trying to do.    I'm writing a graphics editing program where I want
> the user
> to be able to choose and save color values.   I start out with a
> vector
> containing blank and white.  When the user selects a new color and
> wants
> to save it I add the new color to the vector.
>
> (def savedColors [black, white])
> .....
> (defn saveColor [color panel]
>  (swap! savedColors  (conj savedColors color))   <-- this does not
>

What you want is:

(swap! savedColors conj color)

David

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

To unsubscribe from this group, send email to 
clojure+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.

Reply via email to