function | since v0.0-927 | clojure.core/drop-while | Edit |
(drop-while pred)
(drop-while pred coll)
Returns a lazy sequence of the items in coll
starting from the first item for
which (pred item)
returns logical false.
Returns a stateful transducer when no collection is provided.
Returns a lazy sequence of the items in coll starting from the first item for which (pred item) returns logical false. Returns a stateful transducer when no collection is provided.
(defn drop-while
([pred]
(fn [rf]
(let [da (volatile! true)]
(fn
([] (rf))
([result] (rf result))
([result input]
(let [drop? @da]
(if (and drop? (pred input))
result
(do
(vreset! da nil)
(rf result input)))))))))
([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)))))