mr-know-it-all / RecursiveJS

An educational library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

RecursiveJS - an educational library

The functions implemented here are naive implementations that serve absolutely no use in production code. Even more, JavaScript doesn't have yet PTC and TCO available in all major browsers, so a recursive looping approach is not scalable. This library is not meant to be used, but to be read and tried out. It shows how beautiful and powerful recursion is, and how good is JavaScript at showing that.

Almost every looping mechanism implemented here is either self recursive or it uses another function from the same library. Spread is used for pattern matching or array destructuring. Also, we get the function's arity with function.prototype.length etc.

How to use: clone the repo and run node tests/tests.js.

You'll find implementations of built in methods (like map, filter, reduce), standard utils library methods (like curry, compose, deepClone), a selection of sorting algorithms, path finding algorithms, tree traversal and more. See the full list of modules below.

Enjoy!

List of modules: