query
On this page

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
(lib.lists.any)

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

Aliases

Implementation

This function is implemented in c++ and is part of the native nix runtime.

src/libexpr/primops.cc:4020

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