On Monday, 25 May 2015 at 19:14:05 UTC, Vlad Levenfeld wrote:
Cycle was tough. I was using T[2] to track slice boundaries but had to retrofit the library with an Interval!(L,R) type to admit the possibility of unbounded dimensions. This has resulted in a fairly easy implementation for cycle, though. https://github.com/evenex/autodata/blob/master/source/spaces/cyclic.d

Yes, it would be great to learn how to create recursive iterators for each subarray.

Foreach is something I am still considering. It is straightforward to define a range adaptor that traverses a multidimensional array lexicographically, but another interesting possibility is to define traversable multidim arrays recursively, eg:

2d array = {1d row, 2d remainder}

This is cool, as it may enable us to write generic traversals for n-dim arrays and trees alike... However I have been struggling to find a way to make such a thing work with foreach cleanly.

That recursive n-dimensional array, but I think that recursion will not be effective.
http://forum.dlang.org/thread/ulhtlyxxclihaseef...@forum.dlang.org#post-mihl6m:241che:241:40digitalmars.com

Reply via email to