Tutorial by Examples

Pure functions are self-contained, and have no side effects. Given the same set of inputs, a pure function will always return the same output value. The following function is pure: function pure(data) { return data.total + 3; } However, this function is not pure as it modifies an externa...
Higher-order functions take other functions as arguments and/or return them as results. They form the building blocks of functional programming. Most functional languages have some form of filter function, for example. This is a higher-order function, taking a list and a predicate (function that ret...
Currying is the process of transforming a function that takes multiple arguments into a sequence of functions that each has only a single parameter. Currying is related to, but not the same as, partial application. Let's consider the following function in JavaScript: var add = (x, y) => x + y ...
In traditional object-oriented languages, x = x + 1 is a simple and legal expression. But in Functional Programming, it's illegal. Variables don't exist in Functional Programming. Stored values are still called variables only because of history. In fact, they are constants. Once x takes a value, it...

Page 1 of 1