I'm a noob, so this is probably a dumb question but, how does this work with
closures?  Can transients be closed over?

Like,

(defn make-transient-counter [init-val]
>   (let [acounter (transient [init-val])]
>     (fn [add-val] (assoc! acounter 0 (+ add-val (nth acounter 0))))))
>

Is that possible?  And if so, what are the thread-safety implications (if
any)?
...
Oh, I just re-read the description page where Rich says,

Not persistent, so you can't hang onto interim values or alias
>

So, would the above code throw an exception?

Thanks,

-- 
John

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to