Okay, functor is a good idea but a weak implementation. My complaint is that it only provides functor behavior for the map function. same is a higher order function that works on anything, and is based on protocols. Take a look at the test cases to understand what I'm talking about.
http://github.com/francoisdevlin/devlinsf-clojure-utils/blob/master/test/lib/sfd/same_test.clj You can find the source for same here: http://github.com/francoisdevlin/devlinsf-clojure-utils/blob/master/src/lib/sfd/same.clj This should replace the contrib lib, because it provide more functionality. On Oct 28, 2:05 pm, Konrad Hinsen <konrad.hin...@fastmail.net> wrote: > On 28 Oct 2010, at 16:42, Amitava Shee wrote: > > > I would like to apply an higher order function on an arbitrarily > > nested data structure which yields exactly the same structure but the > > original values replaced by the result of applying the passed in > > function. > > > This is somewhat akin to the fmap function in Functor type class in > > haskell. I had a brief discussion with Christophe Grande at the Conj > > and he mentioned I post it to the group. > > Look at clojure.contrib.generic.functor/fmap. That's a multimethod > with implementations for the standard Clojure data structures. You can > easily add your own for additional data structures. > > Konrad. -- 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