            (.addDragList drag-group list goog.fx.DragListDirection/DOWN))
     (doseq [card (get-cards)] (add-card card))
     (.init drag-group)
-    (.log js/console "done")))
+    (.log js/console (print-str (cartesian-product [[:a :b] [1 2]])))
+    (.log js/console "done")
+    (listen-drag drag-group (get-cards-layout))))


(defn create-groups
  [columns]
  (let [board (gdom/getElement "board")]
    (map #(let [{name :name} %
                list (gdom/createDom "div" #js{:class "CardList"})
                column (gdom/createDom

   [goog.fx :as gfx]
   ; why the following cannot be imported along with goog.fx?
   [goog.fx.DragListDirection]
   [goog.fx.DragListGroup]
   [goog.fx.DragListGroup.EventType]))

(defn column-id
  [name]
  (str "column-" name))

(defn set-ids
  [prefix objects]
  (-> (reduce (fn [[n acc] object]
                [(inc n)
                 (->> (assoc object :id (str prefix "-" n))
                      (conj acc))]) [0 (empty objects)] objects)
      second))

(defn get-card-deps
  []
  [#{"card-1" "card-3"}])

(defn get-cards
  []
  (let [cards [{:name "Lemon nation!"
                :state "In progress"
                :description "Kill all humans"}
               {:name "Wake up"
                :state "Defined"
                :description "Terminate sleep"}
               {:name "Kick a baby"
                :state "Accepted"
                :description "subj"}
               {:name "Culture training"
                :state "In progress"
                :description "Listen hammer smashed face"}]]
    (set-ids "card" cards)))

(defn get-board
  []
  (gdom/getElement "board"))

(defn get-cards-layout
  []
  (let [board (get-board)
        columns (gdom/getElementsByClass "Column" board)]
    (areduce columns i ret (array-map)
      (let [column (aget columns i)
            card-list (gdom/getElementByClass "CardList" column)
            cards (gdom/getElementsByClass "Card" card-list)
            column-id (aget column "id")]
        (assoc ret
          column-id
          (areduce cards j card-vector (vector)
                   (let [card (aget cards j)]
                     (->> (aget card "id")
                          (conj card-vector)))))))))

(defn add-card
  [{id :id
    name :name
    state :state
    description :description}]
  (let [column (gdom/getElement (column-id state))
        list (gdom/getElementByClass "CardList" column)]
    (gdom/appendChild
     list
     (gdom/createDom "div" #js{:id id :class "Card"}
      (gdom/createDom "div" #js{:class "CardContent"}
       (gdom/createDom "h3" nil name)
       (gdom/createDom "p" nil description))))))
