Skip to content

Instantly share code, notes, and snippets.

const True = (a, b) => a()
const False = (a, b) => b()
const If = (cond, then, else_ = () => {}) => cond(then, else_)
const L = (first, second) => second(first())
const Not = (bool) => (a, b) => bool(b, a)
const Or = (bool1, bool2) => (a, b) => bool1(a, () => bool2(a, b))
const And = (bool1, bool2) => (a, b) => bool1(() => bool2(a, b), b)
const Xor = (l, r) => Or(And(Not(l), r), And(l, Not(r)))
const Xnor = (l, r) => Not(Xor(l, r))