N
Nick Keighley
Algebra is a branch of mathematics which covers operators and relations
between sets. These sets aren't limited to the real numbers set, and the
operators aren't limited to the basic mathematical operators that take real
values as operands. In fact, typically the first contact with algebra tends
not to involve real numbers at all, or basic math operators. Take, for
example, how Venn diagrams tend to be presented in kindergarten.
and so?
Regarding "side effects", the concepts which I've referred to are indeed
covered, and they tend to be covered right in the very first explanation of
what a function is supposed to be. Once you were taught that a function f
maps elements in a set A to elements in a set B, you covered all the math
that is needed to explain and understand "side effects". No new math is
needed to describe a function assigning a certain value to a flag, or
returning a different value depending on the value stored in any other flag.
maths can be used to model almost anything. Including exotic
things like functions with side effects; this doesn't mean basic
mathematics covers side effects in any obvious or intuitive sense.
Anyone whose glanced at formal methods (the maths of programming)
would quickly see this.
There are also functional programming languages that go to great
lengths (cf. Haskell monads) to avoid side effects (so far as they
can) precisely because side effect free programs are easier to "reason
about" (analyse mathematically).