Hi all, I would like to announce a new version 0.4.0 of rmap.
The library internals have changed to a simpler and more memory efficient model (i.e. the LinkedHashMap is gone). This model also allows adding new lazy entries to a recursive map and merging them. In addition to that, this version supports a new realization mode: *structural sharing* of the lazy values. When enabled, realizing an entry in a recursive map means that all structurally shared recursive maps that still have this entry will have it realized as well. This mode has to be enabled explicitly. More on this can be read in the API documentation <https://github.com/aroemers/rmap#the-api>. Cheers, Arnout Roemers Functional Bytes <http://functionalbytes.nl> Op vrijdag 10 oktober 2014 10:55:53 UTC+2 schreef Arnout Roemers: > > Hi Ben, > > That's pretty nifty indeed! Maybe a tad memory intensive as it retains the > head, but if it were a more complex, CPU intensive calculation in :next, > that might be very worthwhile. Good stuff. > > Cheers, > -Arnout > > P.S. The memory consumption will be a little less when I think of a way to > efficiently replace the backing LinkedHashMap with an actual persistent > map, while keeping track of the evaluation order. > > Op donderdag 9 oktober 2014 02:53:38 UTC+2 schreef Ben: >> >> This is pretty nifty: >> >> user=> (require '[rmap.core :as rmap]) >> nil >> user=> (def fibs (rmap/rmap FIBS {:a 0 :b 1 :next (-> FIBS (update-in >> [:a] (constantly (:b FIBS))) (update-in [:b] (constantly (+ (:b FIBS) (:a >> FIBS)))))})) >> #'user/fibs >> user=> (defn fib [n] (loop [fibs fibs n n] (if (zero? n) (:a fibs) (recur >> (:next fibs) (dec n))))) >> #'user/fib >> user=> (fib 40) >> 102334155 >> >> -- 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.