     [big-bang.core :refer [big-bang!]]
     [cljs.reader :as reader]
     [goog.net.XhrIo :as xhr]
+    [goog.string :as gstring]
+    [goog.string.format]
     [cljs.core.async :as async :refer [<! chan close!]]))
 
 

   (some true?)))


(defn make-a-map-for-graph
  [s]
  (mapv #(let [c (if (pos? %1) "blue" "red")]
           {"color" c "x" %2 "y" %1 }) (take-last 100 s) (range)))

(defn graph
  [world-state]
  (js/js_graph
   (clj->js (str (:stats world-state)))
   (clj->js [{"key"    "Series #1",
                   "values" (make-a-map-for-graph (:lengths world-state))
                   "color"  "#0000ff"}]))
  world-state)



  [{:keys [initial length lengths stats random?]}]
  (merge initial
         {:lengths lengths,
          :length 0
          :stats stats,
          :random? random?,
          :initial initial}))
