3 Main Features of Curry

3.1 Overview

The major elements declared in program are functions and data structures.

  • A function or operation defines a computation similar to an expression. However, the expression computed by a function has a name and is often parameterized. These characteristics enable you to execute the same computation, possibly with different parameters, over and over in the same program by simply invoking the computation’s name and setting the values of its parameters. A function also provides a procedural abstraction. Rather than coding a computation by means of a possibly complicated expression, you can factor out portions of this computation and abstract them by their names.

  • A data structure is a way to organize data. For example, you can record the movements of your bank account in a column in which deposits are positive numbers and withdrawals are negative numbers. Or you can record the same movements in two columns, one for deposits and another for withdrawals, in which all numbers are positive. With the second option, the columns rather than the signs specialize the meaning of the numbers. The way in which information is organized may ease some computations, such as retrieving portions of information, and is intimately related, through pattern matching, to the way in which functions are coded.

This section describes in some detail both of these features and a number of related concepts. Curry has some additional features not described in this section. Since they are useful to support particular programming tasks, we introduce them later when we discuss such programming techniques.