query
On this page

lessThan

builtins.lessThan

Primop
Docs pulled from | This Revision | 3 days ago


Nix manual

Takes 2 arguments

e1, e2

Return true if the value e1 is less than the value e2, and false otherwise. Evaluation aborts if either e1 or e2 does not evaluate to a number, string or path. Furthermore, it aborts if e2 does not match e1's type according to the aforementioned classification of number, string or path.

Noogle detected

Aliases

Detected Type
lessThan :: Number -> Number -> Bool

Implementation

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

src/libexpr/primops.cc:4652

static void prim_lessThan(EvalState & state, const PosIdx pos, Value ** args, Value & v)
{
    state.forceValue(*args[0], pos);
    state.forceValue(*args[1], pos);
    // pos is exact here, no need for a message.
    CompareValues comp(state, noPos, "");
    v.mkBool(comp(args[0], args[1]));
}