www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - multidimensional indexing/slicing docs?

reply "John Colvin" <john.loughran.colvin gmail.com> writes:
Is there anywhere that describes what Kenji (it was Kenji wasn't 
it?) recently implemented for this?
Aug 06 2014
next sibling parent reply "Vlad Levenfeld" <vlevenfeld gmail.com> writes:
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."
Aug 06 2014
next sibling parent "H. S. Teoh via Digitalmars-d-learn" <digitalmars-d-learn puremagic.com> writes:
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.
Aug 06 2014
prev sibling next sibling parent "H. S. Teoh via Digitalmars-d-learn" <digitalmars-d-learn puremagic.com> writes:
On Wed, Aug 06, 2014 at 11:21:51AM -0700, H. S. Teoh via Digitalmars-d-learn
wrote:
[...]
 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.
OK, found the pull that implemented this, which also has a description of what was implemented: https://github.com/D-Programming-Language/dmd/pull/443 I'll see if I can cook up a PR to incorporate this into the language docs on dlang.org. T -- Heuristics are bug-ridden by definition. If they didn't have bugs, they'd be algorithms.
Aug 06 2014
prev sibling parent "H. S. Teoh via Digitalmars-d-learn" <digitalmars-d-learn puremagic.com> writes:
On Wed, Aug 06, 2014 at 12:16:57PM -0700, H. S. Teoh via Digitalmars-d-learn
wrote:
 On Wed, Aug 06, 2014 at 11:21:51AM -0700, H. S. Teoh via Digitalmars-d-learn
wrote:
 [...]
 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.
OK, found the pull that implemented this, which also has a description of what was implemented: https://github.com/D-Programming-Language/dmd/pull/443 I'll see if I can cook up a PR to incorporate this into the language docs on dlang.org.
[...] https://github.com/D-Programming-Language/dlang.org/pull/625 T -- What is Matter, what is Mind? Never Mind, it doesn't Matter.
Aug 07 2014
prev sibling next sibling parent "Stefan Frijters" <sfrijters gmail.com> writes:
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?
Not what you asked for, but maybe useful nonetheless: Denis Shelomovskij has written a multidimensional array implementation using the new syntax[1]. I've been using it in my code for a while now and it's been working great so far. [1] http://denis-sh.bitbucket.org/unstandard/unstd.multidimarray.html
Aug 06 2014
prev sibling parent "H. S. Teoh via Digitalmars-d-learn" <digitalmars-d-learn puremagic.com> writes:
On Wed, Aug 06, 2014 at 08:48:24AM +0000, John Colvin via Digitalmars-d-learn
wrote:
 Is there anywhere that describes what Kenji (it was Kenji wasn't it?)
 recently implemented for this?
https://github.com/D-Programming-Language/dlang.org/pull/625 --T
Aug 06 2014