             [pinot.draw.visualization :as vis]
             [pinot.util.clj :as pclj])
   (:require-macros [pinot.macros :as pm]))
-
-(def x (html/html [:p [:em "hey"]]))
-(dom/css x {:color :blue})
-(dom/attr x {:class "para"})
-;(dom/val (dom/query "input"))
 
 (defn remove-attribute [elem k]
   (doseq [el (pclj/->coll elem)]

        cy (+ 50 (rand 300))]
    (for [_ (range n)]
      [(+ cx -40 (rand 80)) (+ cy -40 (rand 80))])))

(defn k-means-vis []
  (let [k 5
        N 8
        data (mapcat random-cluster (repeat k N))
        means (clustering/k-means k data)]
    (-> (vis/visual @points)
        (vis/elem (partial data-point "#fff"))
        (vis/enter (partial dom/append (dom/query "svg"))))
    (-> (vis/visual means)
        (vis/elem mean)
        (vis/enter (partial dom/append (dom/query "svg"))))))

(defn clear-svg []
  (dom/empty (dom/query "svg")))


(pm/defpartial mean [[[x y] {:keys [index points]}]]
  (let [color (nth (cycle colors) index)]
    (visualize-group points (partial line [x y]))
    (visualize-group points (partial data-point color))
    [:svg:circle {:r 6 :cx x :cy y :stroke "#333" :fill color}]))

(def initial-state {:next-step :init
                    :k 10
