Chapter 2

Functions in Programming Languages

The simplicity of mathematical functions is often enriched in programming languages with features that facilitate their use as programming abstractions. Some of the most common features are discussed in this chapter. Hybrid languages, which combine functional and object-oriented programming, typically distinguish between operators, methods, and functions and define mechanisms to bridge all three. Additionally, type parameterization, optional arguments, and variable-length arguments are commonly used to define templates that represent families of functions.

2.1 Defining Functions

Most programming languages offer a mechanism to structure code in terms of functions. You define a function by giving it ...

Get Functional and Concurrent Programming: Core Concepts and Features now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.