ClojureDocs

Nav

Namespaces

drop

clojure.core

Available since 1.0 (source)
  • (drop n)
  • (drop n coll)
Returns a lazy sequence of all but the first n items in coll.
Returns a stateful transducer when no collection is provided.
2 Examples
;; although negative (or zero) drop-item-counts are accepted they do nothing
(drop -1 [1 2 3 4])
;;=> (1 2 3 4) 

(drop 0 [1 2 3 4])
;;=> (1 2 3 4) 

(drop 2 [1 2 3 4])
;;=> (3 4) 

;; dropping more items than are present is allowed, and all items are dropped.
(drop 5 [1 2 3 4])
;;=> ()
;; similar to subvec but lazy and with seqs
(take 3 (drop 5 (range 1 11)))
;;=> (6 7 8)
See Also

Returns a lazy sequence of the first n items in coll, or all items if there are fewer than n. Ret...

Added by jartur

Return a lazy sequence of all but the last n (default 1) items in coll

Added by jartur

Returns a lazy sequence of the items in coll starting from the first item for which (pred item) re...

Added by jartur

Returns the nth next of coll, (seq coll) when n is 0.

Added by Dimagog

Returns the nth rest of coll, coll when n is 0.

Added by TimMc
0 Notes
No notes for drop