On Tuesday, 27 December 2022 at 15:09:11 UTC, Sergei Nosov wrote:
Consider, I have the following code:

```d
    auto a = [3, 6, 2, 1, 5, 4, 0];

    auto indicies = iota(3);
    auto ai = indexed(a, indicies);
    ai = indexed(ai, iota(2));

    writeln(ai);
```

Why not use `filter()`, isn't it important to filter out what's in range?

```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]
```
SDB@79

Reply via email to