Higher-order functions

I've mentioned on many occasions that functions are first-class entities in F# because they can be used as arguments for other functions or can be returned from other functions as results. This is exactly the indication of higher-order functions. A higher-order function may have another function as a parameter, it may return another function as a result, or it may perform both these things.

All functions are considered function values in F#; this treatment allows you to not make any distinction between functions and other kinds of values in any context where values are used. I will cover some such contexts here, namely an argument to another function, a value returned from a function, and a part of a data structure.

Anonymous ...

Get F# 4.0 Design Patterns now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.