slightly cleaner version of drop-while, could use yield-from when ready
This commit is contained in:
parent
399ea1889a
commit
9d2ad4b4ff
@ -63,12 +63,11 @@
|
||||
(defn drop-while [pred coll]
|
||||
"Drop all elements of `coll` until `pred` is False"
|
||||
(let [[citer (iter coll)]]
|
||||
(let [found false]
|
||||
(for [val citer]
|
||||
(if (not (pred val))
|
||||
(setv found true))
|
||||
(if found
|
||||
(yield val))))))
|
||||
(for [val citer]
|
||||
(if (not (pred val))
|
||||
(do (yield val) (break))))
|
||||
(for [val citer]
|
||||
(yield val))))
|
||||
|
||||
(defn empty? [coll]
|
||||
"Return True if `coll` is empty"
|
||||
|
Loading…
x
Reference in New Issue
Block a user