As far as the programming techniques there are many that are used in functional programming. Here we will explore just a few. Especially in the direction of improving efficiency. First of all we will discuss how to simulate iteration in functional languages. And we will discuss tail recursion. Here a very good example is the example of how to compute the number of ways in which we can change a given amount of money taking into account that coins come with given values. This is an instance of the problem of computing the number of partitions of a set. Well, it is a very interesting exercise to write down first the recursive version and then try to turn it into a tail recursive version thus achieving efficiency. We shall discuss later memorisation which amounts essentially to the same procedure but this time exploiting references. What we will do is essentially we will build functions with local tables. Finally, this will lead us to discussing objects in functional languages as functions with local state. | ![]() |