Skip to content

Instantly share code, notes, and snippets.

@taiju

taiju/six.js

Last active Oct 9, 2017
Embed
What would you like to do?
const two = (s) => (z) => (s) ((s) (z))
const three = (s) => (z) => (s) ((s) ((s) (z)))
const mult = (m) => (n) => (s) => (z) => (n) ((m) (s)) (z)
const toInt = (n) => (n) (x => x + 1) (0)
// six = (mult) (two) (three)
// six = ((m) => (n) => (s) => (z) => (n) ((m) (s)) (z)) ((s) => (z) => (s) ((s) (z))) ((s) => (z) => (s) ((s) ((s) (z))))
// six = ((m) => (n) => (s) => (z) => (n) ((m) (s)) (z)) ((x) => (y) => (x) ((x) (y))) ((a) => (b) => (a) ((a) ((a) (b))))
// six = ((n) => (s) => (z) => (n) (((x) => (y) => (x) ((x) (y))) (s)) (z)) ((a) => (b) => (a) ((a) ((a) (b))))
// six = ((n) => (s) => (z) => (n) ((y) => (s) ((s) (y))) (z)) ((a) => (b) => (a) ((a) ((a) (b))))
// six = (s) => (z) => ((a) => (b) => (a) ((a) ((a) (b)))) ((y) => (s) ((s) (y))) (z)
// six = (s) => (z) => ((b) => ((y) => (s) ((s) (y))) (((y) => (s) ((s) (y))) (((y) => (s) ((s) (y))) (b)))) (z)
// six = (s) => (z) => (((y) => (s) ((s) (y))) (((y) => (s) ((s) (y))) (((y) => (s) ((s) (y))) (z))))
// six = (s) => (z) => (((y) => (s) ((s) (y))) ((s) ((s) ((s) ((s) (z))))))
const six = (s) => (z) => (s) ((s) ((s) ((s) ((s) ((s) (z))))))
; // wtf
(toInt) (six) // => 6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.