take-nth

functionsince v0.0-927 clojure.core/take-nthEdit
(take-nth n)
(take-nth n coll)

Details:

Returns a lazy seq of every nth item in coll.

Returns a stateful transducer when no collection is provided.


Source docstring:
Returns a lazy seq of every nth item in coll.  Returns a stateful
transducer when no collection is provided.
Source code @ clojurescript:src/main/cljs/cljs/core.cljs
(defn take-nth
  ([n]
   {:pre [(number? n)]}
     (fn [rf]
       (let [ia (volatile! -1)]
         (fn
           ([] (rf))
           ([result] (rf result))
           ([result input]
              (let [i (vswap! ia inc)]
                (if (zero? (rem i n))
                  (rf result input)
                  result)))))))
  ([n coll]
   {:pre [(number? n)]}
     (lazy-seq
       (when-let [s (seq coll)]
         (cons (first s) (take-nth n (drop n s)))))))