[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: why tail recursion matters and why Java isn't it, was Re: lispperformance was Re: problems with lisp



>>>>> "Peter" == Peter Seibel <peter@javamonkey.com> writes:

Peter> What's unnatural about looping? If I find certain algorithms easier to
Peter> think of in terms of a loop (do this, do that, then go back to the
Peter> beginning unless I'm done) what does that mean?

What you're describing is really tail recursion.  The "go back to the
beginning" step isn't written down in most typical looping
constructs.  Thus, there isn't anything unnatural about what you
describe, but, by comparison, typical looping constructs are slightly
unnatural.  (And extensive experience in teaching beginning students
will show you that looping constructs (apart from a memorized form of
"do this 10 times") are  about as hard to grasp as recursion is.)

-- 
Cheers =8-} Mike
Friede, Völkerverständigung und überhaupt blabla