Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!ucsd!ucbvax!v1.physics.oxford.ac.uk!HALLAM From: HALLAM@v1.physics.oxford.ac.uk ("Phillip M. Hallam-Baker") Newsgroups: comp.sys.transputer Subject: Re recursion and the towers of Hanoi. Message-ID: <17558.9010080956@prg.oxford.ac.uk> Date: 9 Oct 90 00:56:52 GMT Sender: daemon@ucbvax.BERKELEY.EDU Organization: The Internet Lines: 28 X-Unparsable-Date: Mon, 8 Oct 90 10:56 +01:00 Dear Net, Isn't all this biz about recursion straying a little from the point? Any recurisve routine can be written without explicit recursion, all that is required is some method of saving the extra state which would be stored on the stack. Some recursive routines have an upper bound on the total amount of state they require such as the towers of hanoi problem. These are the so called "non recursive solutions". However I note that the Hanoi algorithm presented includes "do repeatedly" isn't this starting to look just a teensy weensy bit like a recursive definition trying to get out. The whole point about recursion is not that you can do without it. You can write any program in FORTRAN if you realy have to. Recursion allows in many cases a much more elegant description of the algorithm, a much more abstract description (this is abstraction in the computing sense ie stripped of unnecessary and confusing junk - ie abstraction is a virtue). To present any language as definitive if it lacks recursion 30 odd (or there abouts) years after the discovery of quicksort is rather ridiculous. Ok it may be a bit tricky to allow dynamic allocation in a parallel language - but VMS was doing this almost 20 years ago (yes you can solve the towers of Hanoi in VMS DCL!) Even the FORTRAN 9X (eventualy to become 10X) proposal has accepted the need for recursion, surely occam should as well? Phill M Hallam-Baker Oxford University Nuclear Physics Lab