Agree, it might make sense to do that performance-wise. Although I'm
hoping that the compiler would be able to inline that as well
(optimizing away calls to identity).

Btw, what does :inline-arities do? It sounds like this could do what
we want.

On Feb 24, 5:03 am, 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
>
> On Feb 23, 2:40 pm, Michał Marczyk <michal.marc...@gmail.com> wrote:
>
> > On 23 February 2010 20:26, Sean Devlin <francoisdev...@gmail.com> wrote:
>
> > > Take a look at sort/sort-by in core.  That would be starting point for
> > > fn style.
>
> > Not sure what you mean by that.
>
> > If anything, having an arity-overloaded distinct (optionally accepting
> > a binary predicate to use in place of =) and a separate distinct-by
> > (accepting an extra keyfn argument plus optionally the binary
> > predicate) would make for a more uniform standard lib.
>
> > (I guess I suggested switching to the Haskell naming convention
> > before, but there's no real reason to do that if the same
> > functionality is available, plus I'd be confused by this myself,
> > having gotten used to the Clojure names already... I retract that
> > part.)
>
> > Sincerely,
> > 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

Reply via email to