Isn't all this just a special case of partition-by? (defn drop-by [f coll] (apply concat (rest (partition-by f coll))))
(defn take-by [f coll] (first (partition-by f coll))) user> (drop-by (partial + 2) [2 2 2 3 3 4]) (3 3 4) user> (take-by #(mod % 3) [1 4 1 7 34 16 10 2 99 103 42]) (1 4 1 7 34 16 10) On Apr 3, 6:34 am, Meikel Brandmeyer <m...@kotka.de> wrote: > Hi, > > On 3 Apr., 13:18, Ken Wesson <kwess...@gmail.com> wrote: > > > "Less" involved? > > Your solution combines 5 sequences with drop-while-first-map-second > magic which I personally don't find very self-explaining at first > sight. My solution does one step with only local impact and then > delegates to a single well-known library function. > > For laziness there is some cost involved, I agree. > > Sincerely > Meikel -- 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