All You Need Is Fold

Using the work of Dr. Graham Hutton as our guide, we'll look at how to satisfy all of your list processing needs with one function, fold. First we'll start off simple by finding the length of a list, then we'll reverse a list, followed by and-ing and or-ing a list; all using fold. Next we'll look at implementing the higher order functions of: map, filter, and zip. Last we'll look at fold in action by using it on the Coin Changer kata. You'll never look at fold the same way again.

(Fold, fold, fold)

(Fold, fold, fold)

(Fold, fold, fold)

"There's nothing you can do that can't be done

Nothing you can sing that can't be sung

Nothing you can say but you can learn how to play the game

It's easy

There's nothing you can make that can't be made

No one you can save that can't be saved

Nothing you can do but you can learn to be you in time

It's easy"

All you need is fold

All you need is fold

All you need is fold, fold

Fold is all you need

Using the work of Dr. Graham Hutton as our guide, we'll look at how to satisfy all of your list processing needs with one function, fold.

First we'll start off simple by finding the length of a list, then we'll reverse a list, followed by and-ing and or-ing a list; all using fold.

Next we'll look at implementing the higher order functions of: map, filter, and zip.

Last we'll look at fold in action by using it on the Coin Changer kata.

You'll never look at fold the same way again.
Beginner : functional programming JavaScript ECMAScript 2015 es6 lodash

Back