On Jan 10, 6:21 pm, Dragan Djuric <draga...@gmail.com> wrote:
> Is this on purpose (and what is the reason), or it's just that nobody
> thought that would be useful?
>
> Of course, I am talking about the read-only access to the history.
[snip...]

To minimize memory consumption, refs only keep history if it is needed
by "pending" transactions, although you can force keeping history
with :min-history, see (doc ref).

If you want to store some history you can do it manually by attaching
a watcher:

user> (def a (ref 1))
#'user/a
user> (def a-hist (atom []))
#'user/a-hist
user> (add-watch a :a-watch (fn [key aref old nw] (swap! a-hist conj
old)))
#<r...@4369a50b: 1>
user> (dosync (alter a inc))
2
user> (dosync (alter a inc))
3
user> @a-hist
[1 2]
user> @a
3
user>

/Karl
-- 
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