(defn
walk
"Traverses form, an arbitrary data structure. inner and outer are\n functions. Applies inner to each element of form, building up a\n data structure of the same type, then applies outer to the result.\n Recognizes all Clojure data structures. Consumes seqs as with doall."
{:added "1.1"}
[inner outer form]
(cond
(list? form)
(outer (apply list (map inner form)))
(seq? form)
(outer (doall (map inner form)))
(record? form)
(outer (reduce (fn [r x] (conj r (inner x))) form form))
(coll? form)
(outer (into (empty form) (map inner form)))
:else
(outer form)))