Look at clojure.walk for mapping functions over nested structures:

(defn mapv-in [f coll]

  (clojure.walk/prewalk #(if (coll? %) % (f %)) coll))

Clojure walk api: http://clojure.github.com/clojure/clojure.walk-api.html

On Friday, October 5, 2012 7:58:30 AM UTC+2, nchurch wrote:
>
> I ended up needing the following utility, modified from the Clojure 
> source: 
>
> (defn mapv-in 
>   "maps f over a nested vector structure" 
>   ([f coll] 
>     (let [f #(if (coll? %)(mapv-in f %)(f %))] 
>      (-> (reduce (fn [v o] (conj! v (f o))) (transient []) coll) 
>          persistent!)))) 
>
> I wrote just as much as I needed.  Has anyone else needed to map some 
> function over nested structures?  Is there some standard 
> implementation out there? 
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to