take-nth

added
1.0

ns
clojure.core

type
function

(take-nth n) (take-nth n coll)

Returns a lazy seq of every nth item in coll.  Returns a stateful
transducer when no collection is provided.

                user=> (take-nth 2 (range 10))
(0 2 4 6 8)

            
                ;; N <= 0 is a special case
(take 3 (take-nth 0 (range 2)))
;;=> (0 0 0)

(take 3 (take-nth -10 (range 2)))
;;=> (0 0 0)