[plt-scheme] Perplexed Programmers

From: Marco Morazan (morazanm at gmail.com)
Date: Fri Aug 31 08:14:36 EDT 2007

On 8/31/07, Shriram Krishnamurthi <sk at cs.brown.edu> wrote:
> > Yes, that is closer to the mark. Furthermore, the vast majority of
> > intro to programming textbooks that use Java, for example, seem to
> > purposely avoid recursion as a perfectly good programming technique.
> > The reason must be, of course, that recursion is too hard according to
> > a few people I know.
>
> But in Java (as in its familial predecessors), recursion *is* worse
> than in Scheme.  Even if you write a recursive call in tail-position,
> the lack of tail-call optimization means you do pay a price.  If you
> are a Java programmer, you have no choice but to add this to the set
> of things you must worry about.
>

Yes, of course, I understand that and explain it to my colleagues (and
to my students). We should not ignore a powerful programming technique
simply because of the poor implementation of some PLs. My colleagues,
frankly, do not object because Java does a poor job of handling
tail-recursion. They object, because in their minds recursion is too
hard for students. It really strikes me as amazing, because I fail to
see, for example, how traversing a tree is easier to understand using
a loop.

Cheers,

Marco


Posted on the users mailing list.