Returns a lazy sequence of the items in coll starting from the first
item for which (pred item) returns nil.
;; Note: Documentation should be "starting from the first item for which ;; (pred item) returns logical false, i.e. either of the values false or nil. user=> (drop-while neg? [-1 -2 -6 -7 1 2 3 4 -5 -6 0 1]) (1 2 3 4 -5 -6 0 1)
(defn drop-while
"Returns a lazy sequence of the items in coll starting from the first
item for which (pred item) returns nil."
{:added "1.0"
:static true}
[pred coll]
(let [step (fn [pred coll]
(let [s (seq coll)]
(if (and s (pred (first s)))
(recur pred (rest s))
s)))]
(lazy-seq (step pred coll))))
Comments top
No comments for drop-while. Log in to add a comment.