(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.
Source
(defn drop-while
"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."
{:added "1.0"
:static true}
([pred]
(fn [rf]
(let [dv (volatile! true)]
(fn
([] (rf))
([result] (rf result))
([result input]
(let [drop? @dv]
(if (and drop? (pred input))
result
(do
(vreset! dv 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)))))