You're viewing version 1.2.0 of take-nth. The latest stable version of Clojure Core is 1.3.0.
1.2.0 Arrow_down_16x16



  • (take-nth n coll)
Returns a lazy seq of every nth item in coll.

1 Example top

  • user=> (take-nth 2 (range 10))
    (0 2 4 6 8)
Log in to add / edit an example.

See Also top

Log in to add a see also.

Plus_12x12 Minus_12x12 Source clojure/core.clj:3320 top

(defn take-nth
  "Returns a lazy seq of every nth item in coll."
  {:added "1.0"}
  [n coll]
     (when-let [s (seq coll)]
       (cons (first s) (take-nth n (drop n s))))))
Vars in clojure.core/take-nth: cons defn drop first lazy-seq when-let
Used in 2 other vars with-local-vars sliders

Comments top

No comments for take-nth. Log in to add a comment.