Certainly looks like a valid use of transients. Might be related to http://dev.clojure.org/jira/browse/CLJ-829 but I dunno.
On Sep 16, 9:55 am, Sergey Didenko <sergey.dide...@gmail.com> wrote: > When I convert the following code to use transients it returns > different result. Am I doing anything wrong or is it a bug in > transients? > > (defn tt [] > (loop [i 0 tset #{}] > (if (= i (int 5e5)) > (count tset) > (recur (inc i) > (let [nn (rem (* i (int 1e3)) 131071) > plus (count (filter #(contains? tset %) (range nn > (+ nn 10)))) > ] > (conj tset (+ plus nn))))))) > (tt) > > 131074 > > (defn tt [] > (loop [i 0 tset (transient #{})] > (if (= i (int 5e5)) > (count (persistent! tset)) > (recur (inc i) > (let [nn (rem (* i (int 1e3)) 131071) > plus (count (filter #(contains? tset %) (range nn > (+ nn 10)))) > ] > (conj! tset (+ plus nn))))))) > (tt) > > 131071 > > P.S. Tested under 1.3-RC0 and 1.2.1 -- 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