           [(-> table
              (assoc-in [head (get w a)] tail)
              (assoc-in [tail (- (get w a))] head))
-           equiv]
+           equiv
+           head]
           
           (and (= a b) (not= head tail))
           (identify table equiv head tail)

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

(defn- induced-table [gens img img0]

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


;; ---- TODO turn these into tests

(defn- print-table [t]
  (doseq [[key row] (sort t)]
            (println key row))
          (println))

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