What are higher order functions in functional programming? How does the 'map' function work and why is it a higher order function?

Higher order functions either have one or more arguments that are themselves functions, return a function as their result, or both. Arguments to higher order functions can themselves be higher order functions, though this is not a requirement. 
The ‘map’ function requires both a function and a list be passed as arguments. Since it requires a function as argument, 'map' must be a higher order function. The function that is passed as an argument is applied to every element of the list (using each element as the argument of the passed function), to form a new list of results. The resulting list will have the same length but may have a different type to the initial list, depending on the function used as argument.

JC

Related Computing A Level answers

All answers ▸

One member of a chess club sends a text file saved in Unicode. What meant by the term "Unicode" and why might this be necessary?


What is the range of denary numbers that can be represented using 8-bit two’s complement binary integers?


Write pseudocode for the binary search algorithm and state, with an explanation, it's worst case complexity in big-O notation


What is the difference between a variable and an identifier?