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

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to