FP for Sceptics: Intuitive guide to map/flatmap

last-ent.com
4 min read
fairly easy
Intuitive guide to learning map/flatmap. Language agnostic way to understand map/flatmap. This is part of my ongoing series, FP for Sceptics.
Backbone of Functional Programming

map & flatmap form the backbone of Functional Progamming. It is very important be comfortable with these two concepts and this guide will help you develop an intuition for them.

This guide is language agnostic but I expect you to be familiar with basic programming concepts like functions, types, data type/objects and list.

Nomenclature

Let me introduce you to some basic terms we will be using to talk about map/flatmap .

Type s are data constructs and they can be Basic Types like Int, String etc.

s are data constructs and they can be like Int, String etc. Container is a special type which contains another type . For example a List of Ints.

is a special which contains another . For example a List of Ints. Function is a function whose input is of Type 1 and output is of Type 2. Type 1 & Type 2 can be same type.

Visualize

Though I have defined three terms it will be easier to think about…
Ent
Read full article