[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: lisp performance was Re: problems with lisp




On Thu, 4 Sep 2003, Michael Sperber wrote:

> The real issue with LOOP and most other looping constructs is (as
> Matthias pointed out), that "looping" almost always is about the
> structure of the data, namely about the structure of self-referential
> data.  Recursive programs simply reflect that fact by having a
> recursive call on the self-reference---it's a clear and
> straightforward way of writing such programs.  "Loop constructs"
> generally obscure that issue.

That makes lots of sense for lists.  In many languages, however, the
vector is a much more prominent data structure, and I don't see the self
reference there.

Would you argue that an iteration through a vector is in fact an iteration
through its indices, and that the self reference is Integer->Integer?

Or would you concede that a loop (of the for(int i = 0; i < x; i++)
variety, although hopefully abstracted further than that) is a more
"straightforward" way of dealing with vector data?

I have no particular opinion either way, I'm just curious.