In Chapter 6, Dr. Meijer guides us through the world of recursive functions. In Haskell, functions can be defined in terms of themselves. Such functions are called recursive.
For example:
factorial 0 = 1
factorial (n+1) = (n+1) * factorial n
factorial maps 0 to 1, and any other positive integer to the product of itself and the factorial of its predecessor.
Some functions, such as factorial, are simpler to define in terms of other functions. As we shall see, however, many functions can naturally be defined in terms of themselves.
Properties of functions defined using recursion can be proved using the simple but powerful mathematical technique of induction.
functional, programming, haskell