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