Name: Anonymous 2009-12-13 8:21
Take a look at this: http://www.fsharp.it/2009/08/26/functional-programming-interview-question/
Now, this is screaming for an imperative implementation. Doing it in the functional way is not only more difficult, but yields a shittier solution, since the function is not tail recursive, so on large inputs it will result in stack overflow.
I know that in F# you can go on the imperative way too. But there are purely functional languages where you can't. So what is the benefit of using the functional paradigm in this case?
Also if we use local variables and not modifying state outside of our function, how the fuck does that hinder us in parallelism?
So does using recursion everywhere have a real benefit, or is it just unnecessary pretentiousness?
Now, this is screaming for an imperative implementation. Doing it in the functional way is not only more difficult, but yields a shittier solution, since the function is not tail recursive, so on large inputs it will result in stack overflow.
I know that in F# you can go on the imperative way too. But there are purely functional languages where you can't. So what is the benefit of using the functional paradigm in this case?
Also if we use local variables and not modifying state outside of our function, how the fuck does that hinder us in parallelism?
So does using recursion everywhere have a real benefit, or is it just unnecessary pretentiousness?