I scratched my head over this, but now I think these "iterators" must be the same thing as loopless generators --- see http://en.wikipedia.org/wiki/Loopless_algorithm This topic has surfaced previously on math-fun, with respect to various combinatorial problems; two insights have arisen during my investigations. Firstly, that a decent object-oriented / ADT programming environment greatly facilitates the implementation and useability of such tools. 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. Fred Lunnon On 6/10/14, Joerg Arndt <arndt@jjj.de> wrote:
I missed this message...
I agree that a project "iterators" as suggested below appears worthwhile. The chances of adoption in other programs (say, Sage) appear low, however.
This is way I concentrate an finding new orders with interesting properties instead. "interesting properties" would be "changes only at end and of bounded length" for these subset-lex and SL-Gray orders.
It seems hard to believe that the Gray code for compositions isn't already known; I tried hard to find it in the literature, to no avail.
Best regards, jj
* rcs@xmission.com <rcs@xmission.com> [May 28. 2014 12:13]:
Once upon a time, I worked at a Lisp-based company. The main technical guru had built a package of "iterators" that fit into the Lisp loop sub-language. Simple iterators were to count through a range, to march down a list or array, and to run through special sets relevant to the company.
I later wrote a long list of iterator-combiners that would take cross-products of iterations in various orders, and handle instructions like "next", and perhaps "previous", "skip to next row", "goto position N", and so on. I never wrote any actual code.
I think this might be a worthwhile activity, at least as an intellectual exercise.
Rich