[erlang-questions] Erlang for youngsters
Tue Jun 24 00:34:03 CEST 2014
I'm confused by your response... is it possible to do tail-recursion in
Java (and thus make iteration and recursion similar)?
I had imagined that each recursive function call in a JVM would add a frame
to the stack and eventually cause an overflow.
Maybe I missed making my point. :(
On Sunday, June 22, 2014 11:40:54 PM UTC-5, Richard A. O'Keefe wrote:
> On 21/06/2014, at 12:58 PM, Steve Davis wrote:
> > It's not hard... but can be extremely expensive if it builds a call
> stack (e.g. Java)...
> Presumably "It" here refers to "recursion".
> Extremely expensive compared to *what*?
> There are problems where you could naturally use either
> iteration or tail recursion, and it doesn't matter which
> one you use because they are the same thing.
> And there are problems that can be expressed simply using
> general recursion. For those problems, doing without it
> results in code that harder for people and worse for computers.
> There can be no problems that are easier with iteration than
> recursion, although there can be problems that are easier
> with particular *syntax*.
> If we are talking about "Erlang for youngsters",
> I wonder whether it might not be easier to teach
> the *use* of higher-order traversal functions than
> direct loops of any kind. I remember it being
> *amazing* how much you could get done in APL without
> a loop of your own in sight.
> erlang-questions mailing list
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the erlang-questions