O'Reilly logo

The Functional Approach to Programming by K. Callaway, Michel Mauny, Guy Cousineau

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Part I

Basic Principles

 

 

 

Functional programming is a style that uses the definition and application of functions as essential concepts. In this approach, variables play the same role as in mathematics: they are the symbolic representation of values and, in particular, serve as the parameters of functions. The fundamental syntactic idea is that of an expression, and we define functions, starting from expressions, by using variables as parameters.

For example, in the language CAML, the expression

 

image

designates the function that associates x with 2*x+1.

If we wanted to define the same function in PASCAL or in C, we would write:

 

or

 

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required