Skip to content

Latest commit

 

History

History
43 lines (29 loc) · 664 Bytes

README.md

File metadata and controls

43 lines (29 loc) · 664 Bytes

npm

Arithmetics in lambda calculus

Boolean

const { _true, _false, not, or, and } = require("./boolean");

not(_true);
// => _false

or(_true)(_false);
// => _true

and(_false)(_true);
// => _false

Numbers

const { zero, is_zero, succ, pred } = require("./numbers");

const one = succ(zero)

is_zero(zero);
// => _true

pred(one);
// => zero

Recursion

const { zero, succ, eq, add } = require("lambda-arithmetics");

const two = succ(succ(zero));
const four = succ(succ(two));

eq(add(two)(two))(four)) 
// => _true