
On 18/02/2008, Johannes Waldmann
Cale Gibbard wrote:
Lists are our loops. It has nothing to do with an aversion to using other sequence types. Lists reify linear recursion directly. So the real question I suppose is why loops are so popular.
Well, loops are certainly popular in imperative programming, because there you have only one world, and it goes through a linear sequence of states.
But we don't need that in functional programming - and if we're using "State" (or sequencing), then it's perhaps a (premature) optimization (towards the von-Neumann execution model).
I don't see this as the issue. State really has nothing to do with why loops are popular, at least in my mind. They come up a lot because they are the simplest possible kind of recursion, involving only one recursive call. You could think of the parameters to that recursive call as being the state if you like, but that seems artificial to me.