(defn symmetrize-body-parts "Expects a seq of maps which have a :name and :size" [asym-body-parts] (loop [unprocessed-parts asym-body-parts processed-parts nil] (println (str "processed: " processed-parts)) (println (str "unprocessed: " unprocessed-parts)) (if unprocessed-parts (let [[current-part & remaining-parts] unprocessed-parts processed-with-left (conj processed-parts current-part)] (println (str "current: " current-part)) (if (left-match current-part) (recur remaining-parts (conj processed-with-left {:name (left-match-replace current-part) :size (:size current-part)})) (recur remaining-parts processed-with-left) ) ) processed-parts ) ) ;loop ) ;defn (defn symmetrize-body-parts-with-reduce "Same shit, more functionally" [asym-body-parts] (reduce (fn [processed-parts current-part] (println (str "current: " current-part)) (let [processed-with-left (conj processed-parts current-part)] (if (left-match current-part) (conj processed-with-left {:name (left-match-replace current-part) :size (:size current-part)}) processed-with-left) ) ) nil ;initial collection asym-body-parts ;reduced collection ) ;reduce ) ;defn