Skip to content

Instantly share code, notes, and snippets.

@rsp
Last active November 29, 2017 15:14
Show Gist options
  • Save rsp/96cd139b546447372483a9c5c52af7c7 to your computer and use it in GitHub Desktop.
Save rsp/96cd139b546447372483a9c5c52af7c7 to your computer and use it in GitHub Desktop.
The input functions from https://github.com/rsp/ifm-lw-r1-ojs
// Applies x() 1 time:
function input1(x) {
return function (y) {
return x(y);
};
}
// Applies x() 2 times:
function input2(x) {
return function (y) {
return x(x(y));
};
}
// Applies x() 10 times:
function input3(x) {
return function (y) {
return x(x(x(x(x(x(x(x(x(x(y))))))))));
};
}
// Applies x() 100 times:
function input4(x) {
return input3(input3(x));
}
// Applies x() 1000 times:
function input5(x) {
return input3(input4(x));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment