I don't know about a standard solution, but my take is that you can use the built-in 'frequencies' function to build up a frequency table for the list, then filter on anything that occurs more than once:
(defn get-ties [coll] (let [freqs (frequencies coll)] (filter #(> (freqs %) 1) coll))) On Nov 10, 1:28 pm, David Jacobs <develo...@allthingsprogress.com> wrote: > I have a sorted list, and I'd like to derive from that a list > containing all "ties" in the original. > > That is, if I have (1 2 3 4 4 5 5 5 5 5 6 9 12 12), I want to get back > the sequence (4 4 5 5 5 5 5 12 12). > > My first thought was to try to filter down the list, but filter takes > each element of a list in step. One hack might be to pass the original > list through a partition function[0], then filter that list using > (filter #(> (count %) 1)). Seems messy, though. > > Is there a standard solution to this problem that I'm not aware of? > > Thanks, > David > > [0]:http://groups.google.com/group/clojure/browse_thread/thread/f1593f492... -- 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