Higher Order Functions

These are lecture notes from my Computer Science course. For learning about functional programming, in particular Haskell, I recommend Programming in Haskell.

Recap about list reversal

Something to bear in mind – if the list seems to be in the wrong order, use an accumulator to reverse as you go along.

Higher order functions (with regards to generalisation)

Remember that a higher order function is a function that takes and/or returns functions. Remember that curried functions are higher order. They are often used to provide Parametrised recursion schemes which reduces the need for explicit recursion from scratch (apparently).

map and filter are higher order functions because they take a function as a parameter, and a list to apply that function to. Fairly simple functional programming stuff. These are the afore mentioned Parametrised recursion schemes – they recurse based on their parameters, you don’t have to explicitly write the recursion.

This entry was posted in fun, lecture. Bookmark the permalink.