Looks like a good addition for 4clojure. On Jul 19, 2012 8:36 PM, "Alan Malloy" <a...@malloys.org> wrote:
> No, but it's pretty easy to write: > > (defn map-depth [f coll depth] > (if (zero? depth) > (map f coll) > (for [x coll] > (map-depth f x (dec depth))))) > > On Tuesday, July 17, 2012 7:17:19 PM UTC-7, Seth Chandler wrote: >> >> I'm new both to Clojure and to this group, so please be gentle. I come >> to Clojure mostly from a Mathematica background, which has a certain >> Lispyness to it. One of the things one can do in Mathematica is to map a >> function to an s-expression but not at its top level, but rather at some >> user specified level. Thus Map[f, {{a,b},{c,d}},{2}] will (because of the >> {2} as the last argument) evaluate to {{f[a],f[b]},{f[c],f[d]}} rather than >> {f[{a,b}],f[{c,d}]}. I have found this capability of having functions that >> work at levels of an expression to be extremely valuable. Is there work >> already done that extends the higher order functions to permit something >> like this. And, yes, I am sure one could write a macro and perhaps that >> has already been done, but I was curious as to what was out there. My >> Google search did not yield much on this topic, but perhaps I used the >> wrong Clojure vocabulary. >> >> Thanks >> > -- > 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 -- 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