Skip to content

Instantly share code, notes, and snippets.

View yxqsnz's full-sized avatar
:shipit:
I *try* to fix bugs

yxqsnz

:shipit:
I *try* to fix bugs
  • Brazil
View GitHub Profile
@RodrigoDornelles
RodrigoDornelles / from-scratch-boolean.js
Created July 8, 2022 23:41
from scratch boolean logic recreation based on the pure functional paradigm and lambda calculus.
const TRUE = (p) => (q) => (p)
const FALSE = (p) => (q) => (q)
const OR = (p) => (q) => p(p)(q)
const NOT = (p) => (p)(FALSE)(TRUE)
const AND = (p) => (q) => (p)(q)(FALSE)
const PROG = (func) => FALSE(func())(PROG)
const PRINT = (text) => () => TRUE(console.log(text))
const IF = (cond) => (execute) => (nonexecute) => (cond(execute)(nonexecute))()
PROG