Skip to content

Instantly share code, notes, and snippets.

View fernandounger's full-sized avatar

Fernando Unger fernandounger

  • Rio de Janeiro, 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
@RodrigoDornelles
RodrigoDornelles / from-scratch-oop.php
Last active July 21, 2022 20:54
from scratch object-oriented recreation based on the functional paradigm.
<?php
$class = call_user_func(function () {
$objects = [];
return function() use (&$objects) {
return (object) [
'instanceof' => function($object) use (&$objects) {
return in_array($object, $objects);
},