>
>
> OK, I am working with refs, let's do it!:
>
> (let [x (with-meta (ref {:a 42})
>>                 {:raw 17})]
>>    (alter-meta! x #(update-in % [:raw] inc))
>>    (meta x))
>
>
> Nope. IRef cannot be cast to IObj. ...google...google... Hunh? The :meta 
> option on ref? 
>
> [1] Why the special mechanism? 
>
> Well, when in Rome...:
>
> (let [x (ref {:a 42}
>>              :meta {:m 17})]
>>   (alter-meta! x #(assoc-in % [:m] 64))
>>   (meta x))
>> ;; => {:m 64}
>
>
> Booyow!
>
> The bad news is that the metadata is about the map, not the ref. 
>

Hmmm. The map inside the ref will change on each update, so the metadata 
would be lost. OK, on the ref it goes. But this question remains:
 

> [2] If I modify the map inside the ref and the ref's metadata at the same 
> time, will the latter "stick" even if the former gets rolled back?
>

-hk

-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to