On 23 February 2010 21:03, Sean Devlin <francoisdev...@gmail.com> wrote: > I guess I was getting at how to do the airity overloading. My first > instinct when developing is do something like this > > (def distinct > ([coll] (distinct identity coll)) > ([f coll] (lot-of-code))) > > However, if you look around core, you'll see that Rich "repeats > himself" a lot. This really obvious w/ fns like juxt & partial. It > turns out that this is results in faster code. So I'd implement > distinct like this. > > (def distinct > ([coll] (lots-of-code)) > ([f coll] (lot-of-similar-code))) > > That's all I was saying. > > Sean
That's a very valid point! (Which I previously completely failed to grok.) For a "private" utility function, I guess I normally prefer DRYer, perhaps slightly slower code, but for a library function it's a different matter... Anyway, thanks for the clarification! How about that sorted-map vs hash-map thing with group-by? I'm genuinely curious. All best, Michał -- 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