Yep, this was my thinking too.  Maybe it doesn't matter, but I'm always
a little reluctant to make those sort of compromises when writing
general-purpose utility functions.

Mark


Andrew Baine <andrew.ba...@gmail.com> writes:

> If coll has O(n) access and we impose the restriction that indices is
> increasing (or sort it up front), we can do better than this by only
> doing one pass through coll.
>
> On Aug 18, 10:46 am, CuppoJava <patrickli_2...@hotmail.com> wrote:
>> The most straight-forward answer I would have given is also:
>> (defn slice [indices coll]
>>   (map #(nth coll %) indices))
>>
>> Is there some disadvantage with this approach that I'm not seeing?

-- 
Mark Triggs
<mark.h.tri...@gmail.com>

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