 
 (defn group-clusters
   "group a list of cluster groups into one cluster group"
-  ([l] (group-clusters l (vector/make-vector (count l)) 0))
-  ([l a i]
+  ([^ints l] (group-clusters l (vector/make-list (count l))))
+  ([^ints l ^ints a]
     (cond
-      (empty? l) (vec (pmap first a))
+      (empty? l) a
       :else
-        (recur (rest l) (assoc a i (conj (nth a i) (nth (first l) i))) (inc i)))))
+        (recur (rest l) (map into (first l) a)))))
 
 (defn cluster-p
   "take a list of vectors and cluster on centroids c via distance in parallel"
-  ([l c] (cluster-p l c []))
-  ([l c a]
+  [^ints l ^floats c]
     (let [clusters (for [i (partition-all (int (/ (count l) (count c))) l) :let [m (future (p :cluster (cluster-m i c)))]] (deref m))]
-      (p :group-clusters (group-clusters clusters)))))
+      (p :group-clusters (group-clusters clusters))))


(defn cluster-m
  "take a list of vectors and cluster on centroids c via distance"
  ([l c] (cluster l c (vector/make-vector (count c))))
  ([l c a]
    (cond
      (empty? l) a
      ; otherwise we continue until the list of vectors is empty
      (not-empty l)
        ; for the vector at the start of the list, choose a centroid which is closest
        (let [i (min-index (p :min-distance (min-distance-p-m c (first l))))]
          ; append the vector to the smallest distance
          (recur (rest l) c (assoc a i (conj (nth a i) (first l)))))
      :else

  "returns the index of the centroid c closest to vecotr v"
  [c v]
    (for [i c :let [d (distance i v)]] d))

(defn cluster
  "take a list of vectors and cluster on centroids c via distance"
