Functional Programming in Practice
Aligned to the AQA 7517 specification
- Level
- Advanced
- Reading time
- 5 min
- Published
- 13 June 2026
- Updated
- 1 July 2026
On this page
Key takeaways
- A higher-order function either takes a function as an argument or returns a function as its result (or both); map, filter and fold are the standard examples.
- map applies a function to every element of a list and returns a new list of the same length, while filter keeps only elements for which a predicate returns True, so its output may be shorter.
- fold (reduce) repeatedly applies a function to an accumulator and each element to produce a single value; foldr processes right to left and foldl left to right, which matters for non-associative operations.
- A list is defined recursively as either the empty list [] or a head prepended to a tail (head : tail), so [1, 2, 3, 4] is 1 : 2 : 3 : 4 : [].
- The prepend operator : adds one element to a list and is O(1), whereas ++ concatenates two lists and is O(n); calling head or tail on [] is an error.
Worth saving these ideas?
Turn what you've read into instant revision cards. Free to get started.
Key terms
- Higher-order function
- A function that takes a function as an argument, returns a function as its result, or both.
- map
- A function that applies a given function to every element of a list and returns a new list of results.
- filter
- A function that returns a new list of only the elements for which a predicate function returns True.
- fold (reduce)
- A function that processes a list by repeatedly applying a function to an accumulator and each element, producing a single value.
- Accumulator
- The running value that fold combines with each list element and ultimately returns.
- Head
- The first element of a list.
- Tail
- The rest of a list after the head, that is all elements but the first.
- Predicate
- A function that takes one argument and returns Bool, used by filter to decide which elements to keep.
- Partial application
- Supplying some arguments to a function to create a more specific function, as in (>10) meaning \\x -> x > 10.
Frequently asked questions
map transforms every element, so the output list has the same length as the input. filter selects elements using a predicate that returns Bool, so the output may be shorter. Use filter to keep only certain elements and map to transform all of them.
foldr processes a list from right to left with the accumulator on the right, while foldl processes from left to right. For associative operations like + and * both give the same result, but for non-associative ones like subtraction or list construction the direction matters.
head [] and tail [] are undefined in Haskell, so they cause errors. Recursive list functions must handle the base case [] before applying head or tail, since the empty list has no first element or remainder.
Generate revision on any topic you study
Type any topic you're studying and Aicademy generates a complete lesson, quiz, and flashcard set, personalised to your level.
Lessons on anything
Structured, level-matched lessons on any topic you study
Practice quizzes
Find out what you actually know before the exam does
Flashcard sets
Lock in key concepts with instant revision cards
Ask Aica
Stuck on something? Get a clear explanation, any time
Functional Programming Paradigm
Systematic Software Development
Related lessons
5 min