That looks great, Tom, thanks - I'll definitely spend some time exploring
that.
Cheers,
Colin
On 3 June 2013 19:55, Tom Van Cutsem wrote:
> If you're the kind of person who rather reads source code than
> documentation, you might also be interested in my meta-circular
> implementation of Cloju
If you're the kind of person who rather reads source code than
documentation, you might also be interested in my meta-circular
implementation of Clojure's STM (it implements refs in terms of atoms): <
https://github.com/tvcutsem/stm-in-clojure> (the vanilla MVCC version is <
200 LoC)
Cheers,
Tom
Mark Volkmann has a very comprehensive article on Clojure's STM available here:
http://java.ociweb.com/mark/stm/
Cheers,
Michał
On 31 May 2013 13:31, Stefan Kamphausen wrote:
> You may want to use the code from https://gist.github.com/Chouser/456326 to
> study how the history in refs works. S
You may want to use the code from https://gist.github.com/Chouser/456326 to
study how the history in refs works. See the accompanying discussion at
http://clojure-log.n01se.net/date/2010-06-28.html. I've been using
variants of that stress test to explain the ref history behavior since then
an
Thanks guys. I have been able to get the ref-history-count greater than 0
by increasing ref-min-history to something greater than 0 and by using long
(using Thread/sleep) running transactions.
Now i get it
Josh
On Thu, May 30, 2013 at 6:01 PM, Neale Swinnerton wrote:
>
> On Thu, May 30, 2013
On Thu, May 30, 2013 at 3:05 PM, Josh Kamau wrote:
>
> I am trying to understand (ref-history-count ref) . I thought it counts
> the number of "old" values in the ref. But in all my tests, its always
> returning zero. How is it used?
>
In clojure's STM, history is created only when required. Thi
ref-count only increment when one of the following occurs:
* min-history > 0
* ref-read-faults > 0 && current-ref-history-count < max-history-count.
;; ref-count increment because min-history > 0
(let [r (ref 1 :min-history 1)
f1 (future (dosync (Thread/sleep 1000)
(
(def my-ref (ref 1))
(defn update-my-ref
[new-value]
(dosync
(alter my-ref #(+ % new-value))
(ref-history-count my-ref)))
Hi guys ;
I am trying to understand (ref-history-count ref) . I thought it counts the
number of "old" values in the ref. But in all my tests, its always
return