On Monday, 25 May 2015 at 18:33:57 UTC, Dennis Ritchie wrote:
Yes, that's what I mean. Some common questions about working with multidimensional arrays need to be addressed. For example, the cycle `foreach` multiple iterators, etc.

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

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.

Reply via email to