On Friday, 27 August 2021 at 04:01:19 UTC, Ali Çehreli wrote:
On 8/26/21 7:17 PM, Merlin Diavova wrote:

[...]

Then the operations downstream will not produce any results. For example, the array will be empty below:

import std.stdio;
import std.range;
import std.algorithm;
import std.string;
import std.functional;

void main() {
  auto significantLines = stdin
                          .byLineCopy
                          .map!strip
                          .filter!(not!empty)
                          .filter!(line => line.front != '#')
                          .array;

  if (significantLines.empty) {
    writeln("There were no significant lines.");

  } else {
    writefln!"The lines: %-(\n%s%)"(significantLines);
  }
}

Ali

And there it is!

I was missing

```d
.filter!(not!empty)
```

My code now works exactly how I wanted. Thanks!

Reply via email to