        ((juxt inc      inc identity dec dec      dec identity inc) x)
        ((juxt identity inc inc      inc identity dec dec      dec) y)))
 
+(defn living-neighbors [cells k]
+  (keep #(get cells %1) (neighbors k)))
+
 (defn create-cell
   ([]
    (create-cell {:r (rand-int 256) :g (rand-int 256) :b (rand-int 256)}))

  (swap! state assoc-in [:soe :channel] (chan-of-primes)))

(defn teardown-soe! []
  (swap! state assoc-in [:soe :channel] nil))

(defn update-soe! [primes-ch]
  (swap! state update-in [:soe :prime-count] inc)


(defn teardown-gol! []
  (swap! state assoc-in [:gol :busy?] false)
  (swap! state assoc-in [:gol :cells] nil)
  (swap! state assoc-in [:gol :generation] 0))

(defn swap-gol! [cells]
  (swap! state assoc-in [:gol :cells] cells)
