[erlang-questions] Erlang for youngsters

Richard A. O'Keefe ok@REDACTED
Mon Jun 23 06:40:38 CEST 2014

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.

More information about the erlang-questions mailing list