Lesson 059

Functional Programming

Pure Functions · Immutability · Map / Filter / Reduce

1:00

How to write programs as pipelines of pure functions over immutable data — and why purity, higher-order functions, and map/filter/reduce make code safer, testable, and naturally concurrent.

By the end, you can

  • Explain the difference between imperative and functional (declarative) programming styles.
  • State the two defining properties of a pure function and identify pure vs impure examples.
  • List at least four examples of side effects.
  • Explain referential transparency and why it enables safe memoization.
  • Explain what immutability means and why it eliminates race conditions.
  • Distinguish first-class functions from higher-order functions.
  • Apply map, filter, and reduce by hand to compute results on small lists.
  • Explain the reduce edge case for an empty list with no initial value.
  • Describe what a closure is and trace its captured variable through a call.
  • Arrange filter → map → reduce into a correct data pipeline.
  • Explain why pure + immutable code is naturally concurrent and how MapReduce exploits it.
  • Recognise functional programming in everyday tools (spreadsheets, React, Redux).
  • Refute the myths that FP is "just lambdas" or "purely academic," pointing to its practical payoff — easier testing, safe concurrency, and predictable code — and its adoption in mainstream languages and data pipelines.
Up next in Recursion, Paradigms & Algorithm Analysis
Questions or feedback?