Generally when you have a "*-by" fn, you return the a sequence of original values, not the mapped values (e.g. sort-by)
However, in the case you suggest, you really should just be using map & distinct, and not creating your own fn. Using the built ins as much as possible is more idiomatic Clojure. (distinct (map f coll)) Sean On Feb 22, 1:39 pm, Michał Marczyk <[email protected]> wrote: > On 22 February 2010 19:25, Sean Devlin <[email protected]> wrote: > > > What does distinct-by return in case of a collision? > > I'm not sure what you mean by that. distinct-by would do precisely > what distinct does, only instead of comparing the items of the > argument collection themselves, it would compare values of (keyfn > item). The return value ought to be a lazy-seq, in keeping with that > of distinct. > > Sincerely, > Michał -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to [email protected] Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/clojure?hl=en
