# Scala Level 5: Functional Programming

> Level 5: Functional Programming of the LoWisa Scala course: Higher-Order Functions, Pure Functions and Immutability, Function Composition. 3 lessons and 9 ideas, each explained in one line.

Functional Programming is level 5 of 13 of the [LoWisa Scala course](/courses/scala/). It has 3 lessons and 9 ideas. Below is every lesson and what it teaches, in one line each.

## Higher-Order Functions

- **Functions taking functions.** Higher-order functions abstract **patterns**: retry(3)(fetchUser) wraps behaviour around behaviour.
- **Currying.** **Curried** parameter lists specialise functions stepwise: configuration first, data later.
- **Function composition.** **andThen** and compose chain functions: pipelines built from named pieces.

## Pure Functions and Immutability

- **Purity.** A **pure** function reads only inputs and changes nothing: same arguments, same answer, testable in isolation.
- **Referential transparency.** **Referential** transparency lets you substitute a call with its value: the property equational reasoning needs.
- **Effects at the edges.** Idiomatic Scala keeps side **effects** at the boundary: a pure core, I/O in a thin shell.

## Function Composition

- **Small functions compose.** Design as **composition**: validate andThen enrich andThen price: each step named, tested, reused.
- **for-comprehensions.** A **for**-comprehension chains map and flatMap readably: Options, Eithers and Futures sequenced alike.
- **Pipelines over loops.** Scala replaces loop bookkeeping with **pipelines**: intent stated, indexes deleted.

## Before and after this level

- **Before:** [Level 4: Algebraic Data Types](/courses/scala/level-4-algebraic-data-types/): Enums and Case Classes, Pattern Matching, Modelling Valid States.
- **Next:** [Level 6: Type System](/courses/scala/level-6-type-system/): Generics, Variance, Type Bounds and Advanced Types.

In the app each of these ideas is taught and then asked back, and the level ends with a checkpoint and flashcards. See [Checkpoints and flashcards](/help/checkpoints-and-flashcards/).

## Frequently asked questions

### What does Scala Level 5: Functional Programming cover?

Higher-Order Functions, Pure Functions and Immutability, Function Composition: 3 lessons and 9 ideas.

### What should I know before this level?

The level before it, Level 4: Algebraic Data Types, which covers Enums and Case Classes, Pattern Matching, Modelling Valid States.

## Learn Scala on your phone

The first level is free. LoWisa is on Google Play and the App Store.

---

Source: https://lowisa.dev/courses/scala/level-5-functional-programming/ · Updated 2026-11-30
