Module church

Module church 

Source
Expand description

Functionsยง

add
Applied to two Church-encoded numbers it produces their sum.
div
Applied to two Church-encoded numbers it returns a Church-encoded pair with the result of their division - the quotient and the remainder.
eq
Applied to two Church-encoded numbers it returns a lambda-encoded boolean indicating whether its first argument is equal to the second one.
fac
Applied to a Church-encoded number it yields its Church-encoded factorial.
geq
Applied to two Church-encoded numbers it returns a lambda-encoded boolean indicating whether its first argument is greater than or equal to the second one.
gt
Applied to two Church-encoded numbers it returns a lambda-encoded boolean indicating whether its first argument is greater than the second one.
is_even
Applied to a Church-encoded number it produces a lambda-encoded boolean, indicating whether its argument is even.
is_odd
Applied to a Church-encoded number it produces a lambda-encoded boolean, indicating whether its argument is odd.
is_zero
Applied to a Church-encoded number it produces a lambda-encoded boolean, indicating whether its argument is equal to zero.
leq
Applied to two Church-encoded numbers it returns a lambda-encoded boolean indicating whether its first argument is less than or equal to the second one.
lt
Applied to two Church-encoded numbers it returns a lambda-encoded boolean indicating whether its first argument is less than the second one.
max
Applied to two Church-encoded numbers it returns the greater one.
min
Applied to two Church-encoded numbers it returns the smaller one.
mul
Applied to two Church-encoded numbers it yields their product.
neq
Applied to two Church-encoded numbers it returns a lambda-encoded boolean indicating whether its first argument is not equal to the second one.
one
Produces a Church-encoded number one.
pow
Applied to two Church-encoded numbers it raises the first one to the power of the second one.
pred
Applied to a Church-encoded number it produces its predecessor.
quot
Applied to two Church-encoded numbers it returns a Church-encoded quotient of their division.
rem
Applied to two Church-encoded numbers it returns a Church-encoded remainder of their division.
shl
Applied to two Church-encoded numbers a and b it returns the left logical shift of a performed b times.
shr
Applied to two Church-encoded numbers a and b it returns the right logical shift of a performed b times.
sub
Applied to two Church-encoded numbers it subtracts the second one from the first one.
succ
Applied to a Church-encoded number it produces its successor.
to_parigot
Applied to a Church-encoded number it produces the equivalent Parigot-encoded number.
to_scott
Applied to a Church-encoded number it produces the equivalent Scott-encoded number.
to_stumpfu
Applied to a Church-encoded number it produces the equivalent Stump-Fu-encoded number.
zero
Produces a Church-encoded number zero; equivalent to boolean::fls.