       {:root {0 {}}
        :extract (fn [table] (when (empty? (free table)) table))
        :children (fn [table]
-                   (for [[t equiv]
+                   (for [t
                          (potential-children table gens rels max-cosets)
-                         :when (and (empty? equiv) (canonical-table t gens))]
+                         :when (and (not (nil? t)) (canonical-table t gens))]
                      t))})))
 
 (defn- induced-table [gens img img0]

            (->> (abelian-factors d) (filter (partial not= 1)) sort))))


;; ----

(defn- debug-generator []
  (let [nr-gens 4

              :when (contains? table t)]
        (println "Equivalences:" (seq equiv))
        (print-table t)))))

(defn- debug-scanrel []
  (let [gens (expand-generators 4)
        rels (expand-relators
               [[1 1] [2 2] [3 3] [4 4] [1 3 1 3] [1 4 1 4] [2 4 2 4]])
        max-cosets 8
        
        table {0 {1 1 -1 1 2 2 -2 2 3 3 -3 3 4 4 -4 4}
               1 {1 0 -1 0 2 5 -2 5 3 6 -3 6 4 7 -4 7}
               2 {1 5 -1 5 2 0 -2 0 3 7 -3 7 4 6 -4 6}
               3 {1 6 -1 6          3 0 -3 0         }
               4 {1 7 -1 7          3 5 -3 5 4 0 -4 0}
               5 {1 2 -1 2 2 1 -2 1 3 4 -3 4         }
               6 {1 3 -1 3          3 1 -3 1 4 2 -4 2}
               7 {1 4 -1 4          3 2 -3 2 4 1 -4 1}}
        
        start 2]
    
    (print-table (scan-recursively rels table start))))

