(defn foldr [f s] (reduce f (reverse s))
Of course that's just one case, but it is a useful example. In this
case the problem of deep recursion is avoided by using a
tail-recursive function (reverse) to build the data structure we need
so that we can use another tail-recursive function (reduce) to get our
answer.
In other cases you may be able to solve the problem using lazy functions.
In practice it turns out to be rare that you have to break down and
use iteration.
--Chouser
I wonder if the Scala principals might be natural allies in this matter?
Have you contacted them?
> ...
>
> Rich
Randall Schulz
I don't think they're opposed to adding tail-calls, but it's not very
high on their list of priorities. In the MLVM[0] project they've
listed it as medium[1].
:dudley
[0] http://openjdk.java.net/projects/mlvm
[1] http://openjdk.java.net/projects/mlvm/subprojects.html