       (zipmap (drop (mod (- 19 p) 16) octagon-boundary)
               (take 16 template-boundary)))))
 
-(defn apply-to-template [ds oct2tmp]
+(defn on-template [ds oct2tmp]
   (let [tmp2oct (clojure.set/map-invert oct2tmp)
         tmp (DynamicDSymbol. template)]
     (doseq [D (keys tmp2oct)]


(defn iterate-cycle [coll x]
  (reductions #(%2 %1) x (cycle coll)))

(defn walk [ds D & idxs]
  (reduce #(.op ds %2 %1) D idxs))

    (doseq [D (keys tmp2oct)]
      (if (not (.definesV tmp 1 2 D))
        (.redefineV tmp 1 2 D (.v ds 1 2 (tmp2oct D)))))
    tmp))

(def octa-sets (filter #(-> %1 max-curvature .isNegative not)
                       (lazy-seq (new CombineTiles octagon))))
