12.3.5 Operations on functions

Dylan has several functions that take functions as arguments, and return new functions that are transformations of those arguments. These operations permit many kinds of composition of functions and other objects to generate new functions.

Three of these functions take predicates as arguments, and return the complement, disjunction, or conjunction of the predicates. For example, complement takes a predicate and returns the latter's complement — a function that returns #t when the original predicate would have returned #f, and otherwise returns #f.

The curry function takes a function and any number of additional arguments. It returns a new function that applies the original function, first to the additional arguments to curry, then to the arguments to the new function. In Section 11.3.7, page 147, we call curry with \* and a number to return a function that multiplies that function's argument by the given number. We then map this new function over the elements of a vector to perform a scalar multiplication of the vector.

In fact, Dylan has a set of functions that map other functions over the elements of collections in different ways. We used one of these, choose, in Section 12.3.3, page 181. Some of these functions return new collections; others return single values. For more examples, see Section 11.3, page 142.