Recursion
- No loops. Erlang has no loops: iteration is recursion, walking a list one head at a time.
- Base and recursive cases. Every recursion states a base case and a smaller step: sum([]) -> 0; sum([H|T]) -> H + sum(T).
- Tail recursion. Tail recursion with an accumulator runs in constant stack: the shape of every long-lived loop.
Lists and Higher-Order Functions
- Cons cells. Lists build from cons cells: [Head | Tail]: matched and constructed with the same syntax.
- lists module. The lists module carries map, filter, foldl: the daily verbs of Erlang data work.
- Funs. A fun is an anonymous function value, written between fun and end: passed to higher-order functions.
Immutable Data Transformation
- Immutability. Erlang data is immutable: transformation builds new terms, and old ones stay true.
- Pipelines by variables. Transformations chain through fresh variables: Parsed, Validated, Enriched: each step named.
- List comprehensions. A list comprehension filters and maps in one readable form, drawing values from a source list.
Before and after this level
- Before: Level 1: Erlang Foundations: Terms and Variables, Pattern Matching, Functions and Modules.
- Next: Level 3: Data & Pattern Matching: Tuples, Maps and Records, Guards, Advanced Pattern Matching.
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.
Frequently asked questions
What does Erlang Level 2: Functional Erlang cover?
Recursion, Lists and Higher-Order Functions, Immutable Data Transformation: 3 lessons and 9 ideas.
What should I know before this level?
The level before it, Level 1: Erlang Foundations, which covers Terms and Variables, Pattern Matching, Functions and Modules.