Can you simplify nested Indexed types?

Salih Dincer salihdb at hotmail.com
Tue Dec 27 16:50:02 UTC 2022


On Tuesday, 27 December 2022 at 16:40:31 UTC, Salih Dincer wrote:
> ```d
> import std.algorithm;
> import std.stdio;
> import std.range;
>
> int[] a = [3, 6, 2, 1, 5, 4, 0];
> auto indicies = iota(3);
> auto ai = a.filter!(e => e >= indicies.front
>                       && e <= indicies.back);
> ai.writeln; // [2, 1, 0]
> ```

Or?

```d
   indicies.each!((i) => a[i].write(" "));
   writeln(); // 3 6 2
```

SDB at 79




More information about the Digitalmars-d-learn mailing list