Thread overview
mir.ndslice : multi dimensional associative array - Example/Docs
Oct 26, 2020
Vino
Oct 27, 2020
9il
Oct 28, 2020
Vino
October 26, 2020
Hi All,

  Is it possible to create a multi dimensional associative array using mir.ndslice,
  if yes,
   (1): request you to point me to some example / docs
   (2): below is an example multi dimensional associative array using the core d module, and
        how can we to implement the same using mir.ndslice.
   (3): What are the pros and cons of using mir.ndslice over the core d module.

import std.stdio;
void main () {
   string[int][string] aa;
   aa["Name"] = [1: "test01", 2:"test02"];
   aa["Pool"] = [1: "Development", 2:"Quality"];
   foreach(i; aa["Pool"].byValue) { writeln(i); }	
}

From,
Vino.B
October 27, 2020
On Monday, 26 October 2020 at 14:31:00 UTC, Vino wrote:
> Hi All,
>
>   Is it possible to create a multi dimensional associative array using mir.ndslice,
>   if yes,
>    (1): request you to point me to some example / docs
>    (2): below is an example multi dimensional associative array using the core d module, and
>         how can we to implement the same using mir.ndslice.
>    (3): What are the pros and cons of using mir.ndslice over the core d module.
>
> import std.stdio;
> void main () {
>    string[int][string] aa;
>    aa["Name"] = [1: "test01", 2:"test02"];
>    aa["Pool"] = [1: "Development", 2:"Quality"];
>    foreach(i; aa["Pool"].byValue) { writeln(i); }	
> }
>
> From,
> Vino.B

No. ndslice provides rectangular arrays. An associative array (as it defined in D) can't be really 2D, instead, it is an AA of AAs like in your example. A real 2D analog associative arrays are DataFrames. It is a postponed WIP ndslice feature.

Ilya
October 28, 2020
On Tuesday, 27 October 2020 at 02:50:55 UTC, 9il wrote:
> On Monday, 26 October 2020 at 14:31:00 UTC, Vino wrote:
>> [...]
>
> No. ndslice provides rectangular arrays. An associative array (as it defined in D) can't be really 2D, instead, it is an AA of AAs like in your example. A real 2D analog associative arrays are DataFrames. It is a postponed WIP ndslice feature.
>
> Ilya

Hi Ilya,

  Thank you very much.