understanding mir, generic nd array iterator

monkyyy crazymonkyyy at gmail.com
Wed Sep 17 14:57:19 UTC 2025


On Wednesday, 17 September 2025 at 12:06:32 UTC, jmh530 wrote:
> On Wednesday, 10 September 2025 at 20:23:28 UTC, monkyyy wrote:
>> [snip]
>
> Documentation for mir iterators is here:
> http://mir-algorithm.libmir.org/mir_ndslice_iterator.html
>

I see nd-iota but it seems under powered(handling only the single 
argument case of iota)
I could spell that `auto fixediota(I)(I start,I 
end)=>iota(end-start).map!(a=>a+start)` to get the 2 argument 
version (3 arguments could be a little tricky)

soooo
```d
fixedndiota(???)=>...
ndfield(???)=>fixediota(???).map!(a=>foo.opIndex(a));
```

That doesnt seem premade anymore

> If you want to use mir without using the GC. You can allocate 
> with malloc, custom allocator, or use an RC allocator.
> http://mir-algorithm.libmir.org/mir_ndslice_allocation.html

Not about allocating, user defined opIndex on user defined data

If mir only defines a single data-type-family and is deeply 
opinionated about controlling it(which seems to be increasingly 
the case) its not generic and leaving some level of simplicity on 
the table.


More information about the Digitalmars-d-learn mailing list