Functional JavaScript

It did not take long reading that Haskell book before I got some inspiration and understood why the functional style of programming is great for writing code that can be verified with mathematical precision. Recursion lends itself to proof by mathematical induction.

I started a new project to explore this. It’s on Github at I don’t recommend anybody else use it yet. I just publish everything to Github because it’s nice for keeping track of things.

Basically, the goal for my new functional-util project is to write the utility functions according to some restraints that are rather unfamiliar in JavaScript. The functions do not mutate any data. Functions read the data and return something, but no function may ever mutate its input data. JavaScript does not natively offer any way to enforce that as far as I am aware. A “pure” functional language offers ways to enforce that rule.

Another part of the goal is to write these functions using recursion as the primary means of looping. The result of a recursion can be proved mathematically using proof by mathematical induction. Eventually I would like all of these utility functions to be self-proving. But it’s not always easy to figure out how to do something using recursion.