multidimensional indexing/slicing docs?

H. S. Teoh via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Aug 6 11:21:51 PDT 2014


On Wed, Aug 06, 2014 at 06:10:43PM +0000, Vlad Levenfeld via Digitalmars-d-learn wrote:
> On Wednesday, 6 August 2014 at 08:48:25 UTC, John Colvin wrote:
> >Is there anywhere that describes what Kenji (it was Kenji wasn't it?)
> >recently implemented for this?
> 
> I'm curious about this as well. I've just come across a case where I
> need to work with a 2D array of channels*samples from an
> analog-digital converter, and what I thought would be a
> straightforward design problem turned out to be pretty complicated. I
> have a C++ solution but its procedural/oop. Going functional and
> range-based would be a huge improvement, but I'm caught in "analysis
> paralysis."

AFAIK, what Kenji implemented was just the support necessary for
implementing a multidimensional array type with overloaded opIndex /
opSlice / opDollar. I don't think there's any functional / range-based
things actually built on top of this at present.  I'm also quite
interested in this topic, and several people in the past have also
voiced similar interests. But I don't think we have anything standard
just yet.

In any case, what Kenji did was basically to implement support for:

	arr[i,j,k,...];		// opIndex
	arr[i,j,k,...] = ...;	// opIndexAssign
	arr[i1 .. i2, j1 .. j2, ...];	// opSlice
	arr[i..$, j..$, k..$];	// opSlice / opDollar

and perhaps one or two others.

And, looking at the docs on dlang.org, evidently this feature isn't
documented yet. :-(  Maybe if I get some free time later today I'll take
a shot at documenting it.


T

-- 
What do you call optometrist jokes? Vitreous humor.


More information about the Digitalmars-d-learn mailing list