 (defn go-emit-heartbeat
   "A go loop to regularly write heartbeat message on channel"
   [control out interval]
-  (go (loop []
-        (let [tick (timeout interval)]
-          (match (alts! [control tick])
-            [nil control] nil
-            [_ tick] (do (>! out heartbeat-req)
-                         (recur)))))))
+  (go-loop []
+    (let [tick (timeout interval)]
+      (match (alts! [control tick])
+        [nil control] nil
+        [_ tick] (do (>! out heartbeat-req)
+                     (recur))))))
 
 (defn go-game [container in out player-id]
   (let [control (chan) ;; TODO integrate further

  "todo: general partition/chunking buffer"
  ([card-chan] (card-selector (chan) card-chan))
  ([c card-chan]
   (go (loop [cs #{}]
         (if (>= (count cs) 3)
           (do (>! c cs) (recur #{}))
           (let [v (<! card-chan)]
             (cond
               (nil? v) (close! c)
               (cs v) (recur (disj cs v))
               :else (recur (conj cs v)))))))
   c))

(defn go-emit-selections [out card-sel]
  (let [sels (card-selector card-sel)]
    (go (loop []
          (when-let [cards (<! sels)]
            (>! out (msg/->PlayerSetMessage cards))
            (doseq [el (sel [:#board :.selected])]
              (dom/remove-class! el "selected"))
            (recur))))))

(defn render-solutions!
  [sets]

            [dommy.template :refer [html->nodes]])
  (:require-macros
    [dommy.macros :refer [sel sel1 deftemplate node]]
    [cljs.core.async.macros :refer [go go-loop alt!]]
    [cljs.core.match.macros :refer [match]]))

(def heartbeat-interval 7500)
