   (:require [clojure.set :as set]
             [kdtree :as kdtree])
   (:import [info.debatty.java.lsh MinHash]
-           [java.util TreeSet]))
+           [java.util TreeSet Set]))
 
 (defn index-set
   [v->idx s]

  (let [n (count coll)
        v (reduce set/union #{} coll)
        dict-size (count v)
        v->idx (value-index v coll)
        sets (index-sets v->idx coll)

        hasher (MinHash. error (int dict-size))
        hash-fn #(into [] (.signature ^MinHash hasher %))
        h (minhash-sets hash-fn sets)
        tree (kdtree/build-tree h)]
    (Similar. v->idx tree hash-fn)))

            (conj mem (with-meta (hash-fn v) {:value k}))) [] indexed-sets))

(defn value-index
  [v]
  (into {} (map-indexed (fn [idx itm] [itm (int (inc idx))]) v)))

(defrecord Similar [v->idx tree hash-fn])

