There you go, symmetry and simplicity :)

On 04/04/2011, at 6:35 AM, Alan wrote:

> 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

--
"Test-driven Dentistry (TDD!) - Not everything should be test driven"
- Michael Fogus
-- 
**********************************************************
Andreas Koestler, Software Engineer
Leica Geosystems Pty Ltd
270 Gladstone Road, Dutton Park QLD 4102
Main: +61 7 3891 9772     Direct: +61 7 3117 8808
Fax: +61 7 3891 9336
Email: andreas.koest...@leica-geosystems.com

************www.leica-geosystems.com*************

when it has to be right, Leica Geosystems

Please  consider the environment before printing this email.

-- 
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