   (reduce #(when %1 (.op ds %2 %1)) D idxs))
 
 (defn chain-end [ds D i j]
+  "Returns the result of alternately applying operators indexed i and j,
+   starting with the element D, until the end of the chain is reached.
+   In case of a cycle, nil is returned."
   (loop [E (walk ds D i)]
     (let [E* (walk ds E j)]
       (cond


(def octagon
  (DSymbol. "1.1:16 1:2 4 6 8 10 12 14 16,16 3 5 7 9 11 13 15:8"))

(def boundary-mappings
  (let [template-boundary (boundary-chambers template (Integer. 1) 0 1 2)


(defn orbit-reps
  ([ds indices seeds]
    (for [[D i] (pretty-traversal ds indices seeds) :when (= :root i)] D))
  ([ds indices]
    (orbit-reps ds indices (iterator-seq (.elements ds)))))

(defn orbit-loopless? [ds indices D]
  (empty? (for [[D i] (pretty-traversal ds indices [D])
                :when (and (not= i :root) (or (nil? D) (= D (walk ds D i))))]
            D)))

