You're viewing version 1.2.0 of drop. The latest stable version of Clojure Core is 1.3.0.
1.2.0 Arrow_down_16x16
  • (drop n coll)
Returns a lazy sequence of all but the first n items in coll.

1 Example top

  • user=> (drop -1 [1 2 3 4])
    (1 2 3 4) 
    
    user=> (drop 0 [1 2 3 4])
    (1 2 3 4) 
    
    user=> (drop 2 [1 2 3 4])
    (3 4) 
    
    user=> (drop 5 [1 2 3 4])
    ()
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:2172 top

(defn drop
  "Returns a lazy sequence of all but the first n items in coll."
  {:added "1.0"}
  [n coll]
  (let [step (fn [n coll]
               (let [s (seq coll)]
                 (if (and (pos? n) s)
                   (recur (dec n) (rest s))
                   s)))]
    (lazy-seq (step n coll))))
Vars in clojure.core/drop: defn lazy-seq let

Comments top

No comments for drop. Log in to add a comment.