Skip to content

Instantly share code, notes, and snippets.

@mrspeaker
Created January 24, 2019 14:31
Show Gist options
  • Save mrspeaker/da5903c0cf0fd378f986271cad60cee0 to your computer and use it in GitHub Desktop.
Save mrspeaker/da5903c0cf0fd378f986271cad60cee0 to your computer and use it in GitHub Desktop.
lambda pairs
let cons = (x, y) => f => f(x, y);
let car = p => p((x, y) => x);
let cdr = p => p((x, y) => y);
let p = cons("a", cons("b", "c"));
console.log(car(p), cdr(cdr(p)));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment