any
lib.any
Primop
Docs pulled from | This Revision | 28 minutes ago
Nixpkgs manual
Returns true if function pred returns true for at least one
element of list.
Inputs
pred-
Predicate
list-
Input list
Type
any :: (a -> Bool) -> [a] -> Bool
Examples
lib.lists.any usage example
any isString [ 1 "a" { } ]
=> true
any isString [ 1 { } ]
=> false
Nix manual
Takes 2 arguments
pred, list
Return true if the function pred returns true for at least one
element of list, and false otherwise.
Short-circuits and does not evaluate elements that appear later in the list if pred evaluates to true.
Noogle detected
Implementation
This function is implemented in c++ and is part of the native nix runtime.
static void prim_any(EvalState & state, const PosIdx pos, Value ** args, Value & v)
{
anyOrAll(true, state, pos, args, v);
}
Implementation
The following is the current implementation of this function.
any