concept binary function in category c++

appears as: binary function, binary functions
Functional Programming in C++

This is an excerpt from Manning's book Functional Programming in C++.

In general, folding doesn’t require that the arguments and the result of the binary function passed to it have the same type. Folding takes a collection that contains items of type T, an initial value of type R (which doesn’t need to be the same as T), and a function f: (R, T) → R. It calls the specified function on the initial value and the first item in the collection. The result is then passed to the function f along with the next item in the collection. This is repeated until all items from the collection are processed. The algorithm returns the value of type R: the value that the last invocation of function f returned (see figure 2.6). In the previous code example, the initial value was 0 (or 1 in the case of multiplication), and the binary function f was addition (or multiplication).

You don’t do anything overly complicated here. You take a binary function—operator> : (int, int) → bool—and create a new unary function object from it that does the same thing as the greater-than operator, but with the second argument fixed to a specific value (see figure 4.2).