Maps, Folds, and Beyond

Functions can take functions as arguments

A map applies a function to each element of a list

This notation is inspired from lambda calculus

We can use λ-calculus to define a function

A fold scans an entire list to return a result

A scan shows the intermediate values of a fold

It makes functions right associative

The ($) function is called a function application.

It composes functions in a readable manner

Plethora of Functions

These are only some of the functions in Prelude

Haskell comes with a bunch more:

Data.List

Data.Char

Data.Map

Data.Set

...and more than 350 others!

No need to memorize these functions. You will learn to use the right ones over time.