On Oct 27, 12:24 am, Meikel Brandmeyer <m...@kotka.de> wrote: > Hi, > > Am 26.10.2009 um 18:55 schrieb Abhijith: > > > (defn foobar [arr--of-arr] > > (let [ acc (transient {}) ] > > (doseq [ [i e] (indexed arr-of-arr) word e ] > > (assoc! acc word (if-let [v (acc word)] (conj v i) [i]))) > > (persistent! acc))) > > I think the problem is the wrong use of transients. Try the following > (untested) version: > > (defn foobar > [vec-of-vec] > (persistent! > (reduce #(assoc %1 (first %2) (conj (get %1 (first %2) []) > (second %2))) > (transient {}) > (for [[i word] (indexed vec-of-vec) > e word] > [e i])))) > > Sincerely > Meikel > > smime.p7s > 3KViewDownload
Thanks. Will run the code and get back to you. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---