@ Ken, Andreas Thank you for your nice implementations!
As far as I can see, there are two main methods of comparing adjacent items of a list: 1) Take the first item of a coll. Compare the remaining items with an offset of 1: (map f coll (rest coll)) ;; apply some sort of filter 2) Take the first and the second item of a coll. Test if both items exists and then compare: (let [x (first coll), y (second coll)] (and x y (= (f x) (f y)))) The first method works for *take-by*, but not for *drop-while* (or so I think). Using the second method *take-by* can be changed into *drop-by* by only changing the last two lines: (defn drop-by2 [f coll] (lazy-seq (when-let [s (seq coll)] (let [x (first s) y (second s)] (if (and x y (= (f x) (f y))) (drop 2 s) (drop 1 s)))))) I am curious to know if one of these methods is the preferred way of doing a comparison in Clojure (aka Python's one way of doing things). The sheer number of possible solutions to the same problem sometimes overwhelms me a bit, so that I'm looking for some orientation ;-) Best regards, Stefan -- 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