On 25 February 2010 03:57, pthatcher <pthatc...@gmail.com> wrote: [...] > (defn count-from [start] > (iterate inc start)) > > ; like python > (defn zip [& lists] > (apply map vector lists)) > > ; like python > (defn enumerate [vals] > (zip (count-from 0) vals)) [...]
By the way, there's an implementation of "enumerate" called "indexed" in clojure.contrib.seq-utils (or clojure.contrib.seq in master): (defn indexed "Returns a lazy sequence of [index, item] pairs, where items come from 's' and indexes count up from zero. (indexed '(a b c d)) => ([0 a] [1 b] [2 c] [3 d])" [s] (map vector (iterate inc 0) s)) Basically the same as yours, but as a single function. Also, if you use it you don't have to write it yourself :) -- Michael Wood <esiot...@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