• (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:2513 top

(defn drop
  "Returns a lazy sequence of all but the first n items in coll."
  {:added "1.0"
   :static true}
  [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:
Used in 0 other vars

Comments top

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