Hi all, I've just run into what appears to be either some subtle transients behaviour I'm misunderstanding, or a bug (I'm running the 1.3 beta).
Given the function: (defn test-fn1 [map-context1] (persistent! (reduce (ƒ [map-context2 key] (when-not (get map-context2 key) (throw (Exception. "Woops!"))) (dissoc! map-context2 key)) (transient map-context1) (keys map-context1)))) (test-fn1 (zipmap (repeatedly 1000 #(rand)) (repeatedly 1000 #(rand)))) operates as I would expect, and returns the empty map {}. Running against a larger input map, however: (test-fn1 (zipmap (repeatedly 10000 #(rand)) (repeatedly 10000 #(rand)))) and the exception starts triggering. Now I thought maybe this had something to do with transients having a limit to the number of ops that can be performed on them (?), so I tried an alternative definition: (defn test-fn2 [map-context1] (persistent! (reduce (ƒ [map-context2 key] (when-not (get map-context1 key) (throw (Exception. "Woops!"))) (dissoc! map-context2 key)) (transient map-context1) (keys map-context1)))) And what's getting me is that the exception is -still- triggering here for sufficiently large input maps. It won't trigger if transients aren't being used. Does this make sense? Even if I'm missing something and using the transients incorrectly, why would the second example still be exhibiting the same problem assuming the initial map-context1 is still persistent? Would really appreciate any kind of input- thanks! -- Peter Taoussanis -- 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