query
On this page

all

builtins.all

Primop
Docs pulled from | This Revision | 24 minutes ago


Nixpkgs manual

Returns true if function pred returns true for all elements of list.

Inputs

pred

Predicate

list

Input list

Type

all :: (a -> Bool) -> [a] -> Bool

Examples

lib.lists.all usage example

all (x: x < 3) [ 1 2 ]
=> true
all (x: x < 3) [ 1 2 3 ]
=> false
(lib.lists.all)

Nix manual

Takes 2 arguments

pred, list

Return true if the function pred returns true for all elements of list, and false otherwise. Short-circuits and does not evaluate elements that appear later in the list if pred evaluates to false.

Noogle detected

Aliases

Implementation

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

src/libexpr/primops.cc:4036

static void prim_all(EvalState & state, const PosIdx pos, Value ** args, Value & v)
{
    anyOrAll(false, state, pos, args, v);
}