 ;; now with basic-list! (or not, does that help here - more like remove those?)
 ;; and go to lower-case?
 ;; should also have id in it
-(defn naive-key-extractor [str]
+
+;; This is a problem: right now it measures rareness based on its own
+;; note, rather than compared to the universe. You filter out lame
+;; words, but also words like 'English' in an article about Basic
+;; English.
+#_(defn naive-key-extractor [str]
     (vec (map first
               (filter #(= (second %) 1)
                       (frequencies (split-words (:text str)))))))
 
-(defn make-word-map [str id]
-  (zipmap (map first
-               (filter #(= (second %) 1)
-                       (frequencies (split-words str)))) (repeat id)))
-;; then merge
-;; should be elsewhere?
+#_(defn get-words [item]
+  (vec (map first
+            (frequencies (split-words (second item))))))
+
+
+;;(merge-with union wm1 wm2)
 
 #_(defn item-view [item owner]
   (reify

;; before items looked like this
;; :items [{:id "foo" :text "bar"}] ;; dammit!

(def id-atom (atom -1))
(swap! id-atom inc) ;; first item, 0
(swap! id-atom inc) ;; second item, 1
(swap! id-atom inc) ;; third item, 2

(defn add-item [app owner]
  (let [new-item-text (-> (om/get-node owner "new-item")
                     .-value)
        new-item {:id (swap! id-atom inc) :text new-item-text}]
    (when new-item
      (om/transact! app :items #(conj % new-item)))))
;; Do this when adding
;;(str (naive-key-extractor item) ", ")

(defn search [app owner]
  (let [search (-> (om/get-node owner "search")

               (apply dom/ul nil
                      (om/build-all visible-item-view
                                    ;; into vec?
                                    (filter (fn [[i _]] (in? (:visible app) i)) (:items app))))))))

(defn main []
  (om/root app-view
