The message below is being cross-posted from the LogoForum. Please
reply here at comp.lang.logo and it will be cross-posted back to the
LogoForum. The original author of this message is
gene_sullivan@[EMAIL PROTECTED]
In LogoForum@[EMAIL PROTECTED]
Pavel Boytchev <pavel@[EMAIL PROTECTED]
> wrote:
>
> Bertrand Carette wrote:
>> May I say that *tail recursion* is just *iteration*
>> in a more readable way ?
Is qua IS ;-)
Yes. Tail recursion CAN and IS manifested/implemented
via a `goto' structure which implements recursion
via this iterative method.
Ideally this would shut up many of the old-school
Comp Sci instructors that came to respond to recursion
as a way of inducing a stack overflow, infinite loop,
or whatever superstitious behavior they came adopt.
With tail recursion one can use recursive solutions,
which quite often are more elegant and `natural',
without mere iteration.
To me this is sort of like using logarithms to do
more-complicated math with less-complicated means:
multiplication can be done via addition;
exponentiation can be done by multiplication.
Tail recursion amplifies the expressive power of
any language allowing it. One can elegantly and
succinctly express an algorithm via recursion
while only requiring the looping control structure
employed with manifesting mere iterative repetition.
I'd argue that those using recursion were more
psychologically primed to either `discover' or `use'
streams than those mentally hobbled with/at iteration.
Logo's repeat loop and other forms of iteration
typically require one to `know' -- up front --
how many times to iteratively repeat some process.
The to `whenever' nature of recursion -- late `closure',
psychologically speaking -- makes it easier to deal
with `streams' of data of necessarily not-known-in-advance
length.
So ... for those fixated on iteration and hesitant or/and
disparaging of recursion, I highly recommend putting in
the effort to get over the hump. Ones' thought processes
are expanded even if one rarely or ever uses it in
programming.
Cheers!
Gene
> I'd say the opposite: *iteration* is a more readable
> way of *tail recursion* ;)
>
>
> For me tail recursion is a way to iterate a recursion. Historically,
> tail recursion was invented as a way to deal with recursion under
> limited memory.
>
> PS. Sometimes Computer Science jargon differs from everyday word
> meaning. So "recursion" for people and for programmers may mean
> different things. Similarly, ordinary people's *or* is not the same as
> programmers' *or*.
>
__._,_.___
LogoForum messages are archived at:
http://groups.yahoo.com/group/LogoForum


|