mirror of
https://github.com/janet-lang/janet
synced 2025-11-07 11:03:04 +00:00
Add any? predicate to core.
This is the contrapositive to `every?`, and is analagous to `or` as `every?` is to `and`.
This commit is contained in:
@@ -1202,6 +1202,15 @@
|
||||
(if x nil (set res x)))
|
||||
res)
|
||||
|
||||
(defn any?
|
||||
"Returns the first truthy valye in ind, otherwise nil.
|
||||
falsey value."
|
||||
[ind]
|
||||
(var res nil)
|
||||
(loop [x :in ind :until res]
|
||||
(if x (set res x)))
|
||||
res)
|
||||
|
||||
(defn reverse!
|
||||
"Reverses the order of the elements in a given array or buffer and returns it
|
||||
mutated."
|
||||
|
||||
Reference in New Issue
Block a user