Algebraic approach

Functional and declarative programming can also be very well conceptualized as an algebraic style. For our purposes, an algebraic approach can be regarded as a certain language of mathematical expressions—a language that consists of two major elements: operators and operands. Operands can be taken to mean data, the information that you want to manipulate, while operators can be taken to mean their behavior as an how this data is utilized.

Consider the expression 1 + 2. Here, numbers 1 and 2 are operands. They represent some numeric data. The + symbol is an operator that binds them together. It has certain semantics associated with it, that of adding one number to another. But it is important to remember that the symbolic ...

Get Mastering Functional Programming now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.