Apologies for muddying the waters here. Now I've done some homework, I see that the emphasis is syntactic rather than algorithmic. Iterators and containers: see http://en.wikipedia.org/wiki/Iterator Andy Latto:
Do you have any evidence for this assertion? Scheme compilers seem to work, and they are required by the language spec to convert certain sorts of recursive programs to iterative ones.
Is this "tail-call optimization" ? http://en.wikipedia.org/wiki/Scheme_%28programming_language%29 I'll wriggle here and admit that I don't any more properly recall how this problem relates to the sort of combinatorial algorithms Joerg and I have in mind. My only scrap of evidence is that I can't (always) manage to do it --- as implied earlier, I'm not claiming that it's impossible at all --- I feel the process ought to be mechanical, but in practice don't see how. A good example of what I mean is algorithm 5.16 in Frank Ruskey's "Combinatorial Generation" for recursive generation of adjacent bracketings. http://www.1stworks.com/ref/RuskeyCombGen.pdf I have stared at this for a goodly while trying to figure out how to transform it into a "loopless" algorithm --- replacing the recursion by backtracking so as to deliver each new bracketing in CAT given the previous one --- but have so far had to admit defeat. Fred Lunnon On 6/10/14, Andy Latto <andy.latto@pobox.com> wrote:
On Tue, Jun 10, 2014 at 10:37 AM, Fred Lunnon <fred.lunnon@gmail.com> wrote:
Secondly, recursion -- hoary standby of so many programming courses -- and looplessness seem mutually incompatible. Converting one type of algorithm into the other is a process which somehow should be mechanical, but in practice always proves next to impossible in nontrivial situations.
Do you have any evidence for this assertion? Scheme compilers seem to work, and they are required by the language spec to convert certain sorts of recursive programs to iterative ones. I program professionally in Lisp, currently using the Lispworks compiler, and it successfully transforms recursive procedures to iterative ones.
Andy
_______________________________________________ math-fun mailing list math-fun@mailman.xmission.com https://mailman.xmission.com/cgi-bin/mailman/listinfo/math-fun