C9 Lectures: Dr. Erik Meijer - Functional Programming Fundamentals Chapter 6 of 13
Download this episode
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.
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.
You should watch these in sequence (or skip around depending on your curent level of knowledge in this domain):
Available formats for this video:
Actual format may change based on video formats available and browser capability.
Comments have been closed since this content was published more than 30 days ago, but if you'd like to send us feedback you can Contact Us.