[prev] 49 [next]

Higher-order Functions

Several patterns of computation exist on lists
  • using the same recursive computation
  • parameterizing the function being applied
Examples:
  • map(L,f) applies a function to each node
  • fold(L,f,z) summarizes a list   (e.g. sum())
Such functions are called higher-order

(i.e. functions that take other functions as parameters)