All Stories

Lazy functor

A thunk ()=>{…} is a subroutine used to inject an additional calculation into another subroutine. Thunks are primarily used to delay a calculation until its result is needed, or to...

IO functor

…continuing from Lazy Functor

Either Monad — A functional approach to Error handling in JS

In Error handling we have two possible paths either a computation succeeds or fails. The imperative way to control the flow is using exceptions and a try/catch block. In functional...

How to reverse a tree in JavaScript the Functional way in 5 lines of code

Trees are the single most important data structure in computer science, after lists. Just about everything you do in your programming career will be related to trees. For example JSON...

Introduction to Functors (Video)

The Idea: In JavaScript the most famous functional programming idea is to use array.map to replace iterations instead of for loops in order to transform the values of the array....