mir.ndslice : multi dimensional associative array - Example/Docs

9il ilyayaroshenko at gmail.com
Tue Oct 27 02:50:55 UTC 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


More information about the Digitalmars-d-learn mailing list