How to sort 2D Slice along 0 axis in mir.ndslice ?

jmh530 john.michael.hall at gmail.com
Wed Mar 11 13:22:14 UTC 2020


On Wednesday, 11 March 2020 at 06:12:55 UTC, 9il wrote:
> [snip]
>
> Almost the same, just fixed import for `each` and a bit polished
>
> /+dub.sdl:
> dependency "mir-algorithm" version="~>3.7.18"
> +/
> import mir.ndslice;
> import mir.ndslice.sorting;
> import mir.algorithm.iteration: each;
>
> void main() {
>     auto m = [[1, -1, 3, 2],
>               [0, -2, 3, 1]].fuse;
>     m.byDim!0.each!sort;
>
>     import std.stdio;
>     m.byDim!0.each!writeln;
> }

Doh on the 'each' import.

Also, I don't think I had used fuse before. That's definitely 
helpful.


More information about the Digitalmars-d-learn mailing list