💻Functional Programming Fundamentals
Stop treating FP like an ideology and start using its cheap wins — pure functions, immutability, map/filter/reduce, and composition — until you can rewrite a small imperative program in clean functional style.
Phase 1The Mental Shift: From Steps to Values
See pure functions, immutability, and referential transparency.
A pure function is just inputs to outputs — nothing else
6 minA pure function depends on its arguments alone and changes nothing outside itself.
Don't change the value — return a new one
6 minImmutability replaces mutation with new-value-each-time, eliminating a whole class of bugs.
If you can swap the call for its result, you have referential transparency
6 minReferential transparency means an expression can be replaced with its value without changing program behavior.
Push side effects to the edges of your program
7 minSide effects can't be eliminated — but they can be cornered into a thin shell around a pure core.
Phase 2Replacing Loops With Map, Filter, Reduce
Refactor for-loops into map, filter, and reduce.
map is a for-loop that returns a new array
5 minmap applies a function to every element and produces a new array of the same length.
filter keeps the elements that pass the test
5 minfilter takes a predicate and returns only the elements where it returns true.
reduce collapses an array down to a single value
7 minreduce walks through an array carrying an accumulator, returning the final accumulator at the end.
Chain map, filter, and reduce to read like a sentence
7 minChained transformations replace nested loops and intermediate variables with a single readable pipeline.
Recursion is FP's loop — and it's friendlier than you remember
7 minRecursion expresses repetition in terms of the function calling itself with a smaller problem.
Phase 3Higher-Order Functions and Composition
Compose higher-order functions and curry for reuse.
A teammate hands you a function. Now what?
6 minA teammate hands you a function. Now what?
Two pure functions glued back-to-back is still a function
7 minTwo pure functions glued back-to-back is still a function
One function, many arities, no headaches
7 minOne function, many arities, no headaches
The function remembered what was around when it was born
7 minThe function remembered what was around when it was born
Phase 4Capstone: Rewrite It Functionally
Rewrite an imperative program in a pure functional style.
Rewrite a small imperative program in pure functional style
25 minRewrite a small imperative program in pure functional style
Frequently asked questions
- What makes a function 'pure' in functional programming?
- This is covered in the “Functional Programming Fundamentals” learning path. Start with daily 5-minute micro-lessons that build from fundamentals to hands-on application.
- Why does immutability matter if I never mutate anyway?
- This is covered in the “Functional Programming Fundamentals” learning path. Start with daily 5-minute micro-lessons that build from fundamentals to hands-on application.
- When should I reach for reduce instead of a for loop?
- This is covered in the “Functional Programming Fundamentals” learning path. Start with daily 5-minute micro-lessons that build from fundamentals to hands-on application.
- What's the difference between map and forEach?
- This is covered in the “Functional Programming Fundamentals” learning path. Start with daily 5-minute micro-lessons that build from fundamentals to hands-on application.
- Do I need a special language to write functional code?
- This is covered in the “Functional Programming Fundamentals” learning path. Start with daily 5-minute micro-lessons that build from fundamentals to hands-on application.
Related paths
🐍Python Decorators Introduction
Build one mental model for Python decorators that covers closures, argument passing, functools.wraps, and stacking — then ship a working caching or logging decorator from scratch in under 30 lines.
🦀Rust Lifetimes Explained
Stop reading `'a` as line noise and start reading it as scope arithmetic — one failing snippet at a time — until you can thread lifetimes through a small parser or iterator adapter without fighting the borrow checker.
☸️Kubernetes Core Concepts
Stop drowning in 30+ resource types. Build the mental model one primitive at a time -- pods, deployments, services, ingress, config -- then deploy a real app with rolling updates and health checks.
📈Big O Intuition
Stop treating Big O as math you memorized for an interview — build the intuition to spot O(n²) disasters, pick the right data structure without thinking, and rewrite a slow function from O(n²) to O(n) in under five minutes.