These elementary problems require you to translate algebraic expressions
into Haskell.
Algebraic expressions are only useful when values are plugged into them.
If we are to make many of them work together we need to be able to talk
about how values are plugged into them. The concept of a function can
be viewed as a way to do this.
These problems involve composition of functions, that is putting
functions together so that the result of one function is passed
to another function.
In Haskell, new functions can be built this with with a "dot"
operator. For example, f.g can be that function which evaluates
f (g x) for any suitable x.
Numbers seldom exist in isolation. Sequences of them are basic to
mathematics. Calculus, for example, wouldn't exist without such
sequences.
In Haskell sequences of numbers are called lists. You can experiment with
them here. Also you can practice writing functions which apply themselves
to each element of a sequence. Functions which can apply themselve to
achieve repetition are called recursive.
You have seen how Haskell can choose which one of many definitions of a function
f to apply. In this section you will look at a general way to choose what to
calculate next within one definition.
A major Haskell construct for branching is if...then...else.... The
concept is
rather simple but the
choices that can be made can be rather complex because they depend on
something called boolean algebra.
Boolean algebra is an algebra not of
numbers but of the values True and False.
These problems ask you to write recursive functions. Recursive functions
are functions that appear in their own definition.