Skip to main content
The boolean module gives you the full set of classical logic gates as Lion functions. All binary operations take exactly two boolean arguments. The unary not takes a single boolean. Passing a non-boolean value produces a schema validation error.

Functions

boolean/not

Negates a boolean value.
["boolean/not", true]
Result: false

boolean/and

Returns true when both arguments are true.
["boolean/and", true, false]
Result: false

boolean/or

Returns true when at least one argument is true.
["boolean/or", false, true]
Result: true

boolean/xor

Returns true when exactly one argument is true (exclusive or).
["boolean/xor", true, false]
Result: true
["boolean/xor", true, true]
Result: false

boolean/nand

Returns false only when both arguments are true (not-and).
["boolean/nand", true, true]
Result: false
["boolean/nand", true, false]
Result: true

boolean/nor

Returns true only when both arguments are false (not-or).
["boolean/nor", false, false]
Result: true
["boolean/nor", false, true]
Result: false

boolean/equals?

Returns true when both boolean values are identical.
["boolean/equals?", true, true]
Result: true

Composing boolean logic

Boolean operations nest naturally to express compound conditions:
["boolean/and",
  ["number/greaterThan", "age", 18],
  ["boolean/not", "isBanned"]]
Prefer cond over deeply nested boolean/and/boolean/or chains when you have three or more conditions. It is easier to read and adds else fallback support.