Mir Algorithm preview: the new ndslice, dlang Iterators, fast generics

Ilya Yaroshenko via Digitalmars-d digitalmars-d at puremagic.com
Wed Feb 8 08:43:52 PST 2017


On Wednesday, 8 February 2017 at 15:33:25 UTC, jmh530 wrote:
> On Tuesday, 7 February 2017 at 16:18:20 UTC, Ilya Yaroshenko 
> wrote:
>>
>> Feedback is welcome!
>>
>
> I don't have time right now to play around with it, but I 
> looked through the documentation. Here are my comments:
>
> 1) I would consider
> http://docs.algorithm.dlang.io/latest/mir_ndslice.html
> to be the first thing that anyone looks at when they think 
> about mir ndslice. I think it's pretty good, but there's always 
> room for some improvements, such as
>
> a) The extent of the compatibility between D's standard library 
> and mir (such as what you wrote in the post above)
> b) Some of your high level explanation for the motivation for 
> recent changes, such as iterators, 
> universal/canonical/contigous. I.e., something along the lines 
> of ndslice is so powerful it can do all these different things.
>
> 2) The explanation of the difference between universal, 
> canonical, and contiguous is in
> http://docs.algorithm.dlang.io/latest/mir_ndslice_slice.html#.Slice
> It should be referenced in functions like 
> Universal/Canonical/Contigous/universal/canonical.
>
> 3) mir.ndslice.topology has universal, canonical, 
> assumeCanonical, and assumeContiguous. Why no contiguous or 
> assumeUniversal?
>
> 4) It looks like some of the functions from std.algorithm, like 
> map, are now in mir.ndslice.topology instead of 
> mir.ndslice.algorithm. You might include more detailed 
> explanations at the top of the documentation of topology and 
> algorithm for why the modules are split up this way.
>
> Keep up the good work.

1, 2, 4 Agreed. I wonder if ndslice (any) is used by companies, 
if so, i can invest more my time to it. Will post a questionary 
in announce.

3) contiguous and canonical can be always safely converted to 
universal. Plus, contiguous can be always safely converted to 
canonical.

Safe: contiguous -> canonical -> universal
Unsafe (has assume prefix)  universal -> canonical -> contiguous

The ndslice composes all kind of random access ranges you may 
have in real life with one interface, one declaration. And this 
is faster to develop (2-10 times less LOC), compile, and execute 
because of implementation techniques. In addition, it is 
multidimensional. bitwise, zip, map are good examples to compare 
Mir and Phobos.



More information about the Digitalmars-d mailing list