Re: seeking memoize that evaluates wrapped function at most once for any given arguments

2011-04-17 Thread Meikel Brandmeyer
Hi, you find such a memoize here: http://kotka.de/blog/2010/03/memoize_done_right.html. It's based on an old discussion thread of memoize here on the group. Then there is cache-dot-clj, which is based on the above: https://github.com/alienscience/cache-dot-clj. Hope that helps. Sincerely Meikel

seeking memoize that evaluates wrapped function at most once for any given arguments

2011-04-17 Thread B Smith-Mannschott
I noticed recently that clojure.core/memoize does not promise that memoized calls will occur only once in the presence of multiple threads. i.e: user=> (dorun (map (memoize (fn [x] (Thread/sleep 1000) (print x))) (repeat 10 1))) 1nil However: user=> (dorun (pmap (memoize (fn [x] (Thread/sleep 10