• (tree-map mapper branch? children root)

0 Examples top

Log in to add / edit an example.

See Also top

Log in to add a see also.

Plus_12x12 Minus_12x12 Source net/licenser/sandbox.clj:14 top

(defn tree-map [mapper branch? children root]
  (let [r (lazy-seq (map (fn zmap-mapper [e] (if (branch? e) (tree-map mapper branch? children (children e)) (mapper e))) root))]
    (cond 
     (vector? root)
     (vec r)
     (associative? root)
     (reduce (fn [m [k v]] (assoc m k v)) {} r)
     (set? root)
     (set r)
     :else 
     r)))
Vars in net.licenser.sandbox/tree-map: assoc associative? cond defn fn let reduce set set? vec vector?
Used in 0 other vars

Comments top

No comments for tree-map. Log in to add a comment.