Re: Code problem: setting an atom from a deref'd atom that's inside a let.

2011-10-25 Thread Jack Moffitt
> Also, I wonder if there are any existing realize type functions? > i.e. > (realize (filter ...)) This is what doseq, dorun, and doall are for. jack. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googl

Re: Code problem: setting an atom from a deref'd atom that's inside a let.

2011-10-25 Thread Tim Robinson
Never mind... I just used 'count'. And sorry to spam the group. On Oct 25, 10:44 am, Tim Robinson wrote: > Good question. > > Also, I wonder if there are any existing realize type functions? > i.e. > (realize (filter ...)) > > or how would I realize without printing? > Tim > > On Oct 25, 10:12 am

Re: Code problem: setting an atom from a deref'd atom that's inside a let.

2011-10-25 Thread Tim Robinson
Good question. Also, I wonder if there are any existing realize type functions? i.e. (realize (filter ...)) or how would I realize without printing? Tim On Oct 25, 10:12 am, "Marshall T. Vandegrift" wrote: > Tim Robinson writes: > > => (defn oops! [] > >     (let [x1  (atom (hash-map)) > >  

Re: Code problem: setting an atom from a deref'd atom that's inside a let.

2011-10-25 Thread Tim Robinson
Yes, that does. Thanks to both of you. Tim On Oct 25, 10:16 am, Chris Perkins wrote: > On Tuesday, October 25, 2011 12:00:04 PM UTC-4, Tim Robinson wrote: > > > This code probably will not make a whole lotta sense since I reduced > > it down to show only the problem at hand, but I'm hoping some

Re: Code problem: setting an atom from a deref'd atom that's inside a let.

2011-10-25 Thread Chris Perkins
On Tuesday, October 25, 2011 12:00:04 PM UTC-4, Tim Robinson wrote: > > This code probably will not make a whole lotta sense since I reduced > it down to show only the problem at hand, but I'm hoping someone can > explain why this doesn't work the way I expected it would: > > => (def data (atom

Re: Code problem: setting an atom from a deref'd atom that's inside a let.

2011-10-25 Thread Marshall T. Vandegrift
Tim Robinson writes: > => (defn oops! [] > (let [x1 (atom (hash-map)) > v1 (filter > #(let [xv1 (@data %)] >(if (= xv1 "v1") >(swap! x1 assoc :k1 "other"))) >(keys @data)) > rxv (rese

Code problem: setting an atom from a deref'd atom that's inside a let.

2011-10-25 Thread Tim Robinson
This code probably will not make a whole lotta sense since I reduced it down to show only the problem at hand, but I'm hoping someone can explain why this doesn't work the way I expected it would: => (def data (atom {:k1 "v1" :k2 "v2" :k3 "v3"})) #'user/data => (def flag (atom nil)) #'user/flag