Solutions to the challange:
- Simple iterative solution with loops and temporary variables: solution-1.js (gist)
- Simple recursive solution with no loops and no temporary variables: solution-2.js (gist)
- Compact functional solution with no loops, no variables and no arithmetical operators: solution-3.js (gist)
Sample input to test the solution: helpers.js
Simple implementation tests:
Extra tests on non-numerical functions:
Magic tests based on
g(f(a)(g)(x)) === a(g)(x) equality:
For any bug reports or feature requests please post an issue on GitHub.
MIT License (Expat). See LICENSE.md for details.