Concrete Proposal: while ... and while ...

Quinn Dunkan quinn at krone.ugcs.caltech.edu
Thu May 20 15:51:16 EDT 1999


On 20 May 1999 18:42:08 GMT, Graham Matthews <graham at sloth.math.uga.edu> wrote:
>Michael P. Reilly (arcege at shore.net) wrote:
>: Seriously, a very well-defined, simple concept for iteration is
>: recursion: in some form most any application for a loop can be
>: expressed as some form of recursion (except in Fortran ;).  In many of
>: the right applications, recursion is easy-to-follow, intuitive and more
>: efficient.  Recursion (usually) requires no change in the language to
>: impliment.  Why don't we use recursion more often?  I think when people
>: answer that question themselves, they'll probably understand my point.
>
>People don't use recursion much because most people are taught iteration
>before recursion and hence find recursion somewhat unnatural. Those who
>learnt recursion first find iteration to be clunky (for example recursion
>is much more amenable to proof, and recursion corresponds more naturally
>with sub-problem decomposition). 

I belong to the latter group, but I think another reason why non-functional
programmers don't use much recursion is that non-functional languages don't
optimize it to be efficient.  I used to use recursion in Python all the time,
but then I started getting 'Maximum recusion depth exceeded', recoded with
loops, and suddenly things were a lot faster too :)  Tail-recursion would be
nice, but python is so dynamic I don't know if it would be possible.  Dylan
seems to get it in there somehow, though, so maybe it is possible?




More information about the Python-list mailing list