[Tutor] Real world use of recursion

Alan Gauld alan.gauld at btinternet.com
Wed Sep 10 07:48:54 CEST 2014


On 10/09/14 03:56, Deb Wyatt wrote:

> "I have never seen or heard of real uses of recursion except for proving cleverness,"
>
> so I thought I would ask you all if that is true.  Is it really not used in real world applications?

Its often used in prototyping and then converted to non-recursive 
solutions for scalability. But that's not because recursion is bad its 
because many programming languages have limited implementations of 
recursion (like Python's limit on how many levels you can go). In 
languages like Lisp, Scheme, and Haskell, recursion is fundamental
to the language and not limited so it is used much more heavily.

But even with its limitations I use recursion in real world programs
at least once or twice a year. Its not a regular technique but it is a 
powerful one  that has its place along with the other functional 
programming techniques like map(), reduce() and lambdas(which are
also limited in Python).

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.flickr.com/photos/alangauldphotos



More information about the Tutor mailing list