     (swap! state assoc-in [:app :update-soa?] true)
     (swap! state assoc-in [:soa :channel] primes)
     (poly/listen-next-tick! (partial update-soa! primes))))
-
-#_(defn start-soa! []
-  (let [primes (chan-of-primes)]
-    (go-loop []
-      (when-let [next-prime (<! primes)]
-        (swap! state update-in [:soa :prime-count] inc)
-        (swap! state assoc-in [:soa :max-prime] next-prime)
-        (recur)))))
 
 (defn stop-soa! []
   (console/info "stop soa")

;; -----------------------------------------------------------------------------
;; Sieve of Eratosthenes Prime Number Generator

(defn chan-of-ints [xform start-n]
  (let [ints (chan 1 xform)]
    (go-loop [n start-n]
      (>! ints n)
      (recur (inc n)))
    ints))

(defn new-prime? [n knowm-primes]
  (every? #(not= 0 (mod n %)) knowm-primes))

(defn chan-of-primes []
  (let [primes (chan)]
    (go-loop [cur-xf (map identity)
              cur-ch (chan-of-ints cur-xf 2)
              knowns [2]]
      (let [prime  (<! cur-ch)
            knowns (conj knowns prime)
            new-xf (filter #(new-prime? % knowns))
            new-ch (chan-of-ints new-xf prime)]
        (>! primes prime)
        (recur new-xf new-ch knowns)))
    primes))

(defn update-soa! [primes]

  (:require
    ;[ankha.core :as ankha]
    [clairvoyant.core :as trace :include-macros true]
    [cljs.core.async :refer [<! >! chan close! onto-chan pipe put! sliding-buffer take! timeout]]
    [clojure.string :as string]
    [goog.dom :as dom]
    [goog.object]
