Xref: utzoo comp.lang.fortran:881 comp.lang.c:11144
Path: utzoo!attcan!uunet!husc6!mailrus!ames!zodiac!joyce!sri-unix!garth!smryan
From: smryan@garth.UUCP (Steven Ryan)
Newsgroups: comp.lang.fortran,comp.lang.c
Subject: Re: Should I convert FORTRAN code to C?
Message-ID: <879@garth.UUCP>
Date: 5 Jul 88 21:56:38 GMT
References: <2742@utastro.UUCP> <20008@beta.UUCP> <224@raunvis.UUCP> <750@garth.UUCP> <528@philmds.UUCP> <817@garth.UUCP> <63@cubsun.BIO.COLUMBIA.EDU>
Reply-To: smryan@garth.UUCP (Steven Ryan)
Organization: INTERGRAPH (APD) -- Palo Alto, CA
Lines: 22

In Algorithmic Language and Program Development, Bauer and Wossner, they cite
Paterson and Hewitt as proving, essentially, recursion is more powerful than
iteration.

>                                           But I've come across a class of
>problem which can only be generally handled through recursion, I think.  I'd
>be intrigued if someone can come up with a Fortran solution.

I don't want to be in position of proving various examples can be done without
recursion, given the above statement and my own opinions. However this example
is interesting.

A recursive solution assumes the existence of a sufficiently large stack. If
this storage is made available to Fortran program (perhaps as blank common),
a nonrecursive solution would store the loop parameters as array elements:

           while still-something-do
              do-it
              increment-lowest-stack-entry
              while it-overflows
                 reset-it
                 increment-the-next-lowest-stack-entry