Let's take a scenario from Mathematics, how would you model the infinite set of natural numbers? A list? An Array? Or a Stream? Even with infinite storage and time, lists and arrays do not work well enough for this scenario. Why? Assuming the largest possible integer an array can hold is x, then you've obviously missed out onx + 1. Lists, although not constrained by initialization, need to have every value defined before insertion.
This section exposed me to the full power and beauty of functional programming. The expressiveness of using functions as values is awesome. For example, a sum of cubes function can use a sum function which itself relies on a reduce function. Think of higher order differentiation in mathematics and you do get the idea. An interesting concept involves … Continue reading SICP Section 1.3 : Thoughts and Concepts
Programming involves manipulating collections of various things. Operations on collections include aggregating values, conversion into other formats and data replacement.
In pure functional languages, functions are not 'invoked', rather a set of arguments is 'applied' to them. Now, if all the arguments are not passed in, then the function is being 'partially' applied. Partial application converts variadic functions (i.e. functions with multiple parameters) into functions of lesser arity by pre-specifying certain argument values.
The biggest advantage of using tail calls is that they allow you to do extensive operations without exceeding the call stack. This makes it possible to do a lot of work in constant space without running into out of memory exceptions; this happens because the frame for the currently executing function is re-used by the newly-executed function call.