On Tuesday, 28 January 2020 at 14:01:35 UTC, Mike Parker wrote:
Robert Schadek was inspired by a post he saw on Hacker News a while back showing an implementation of wc in Haskell totaling 80 lines. He decided he could do better in D. So he did. This post on the D blog shows what he came up with and also provides a brief introduction to ranges.


The blog:
https://dlang.org/blog/2020/01/28/wc-in-d-712-characters-without-a-single-branch/

unittest {
        foreach(it; Iota(1,10).Filter(&isEven)) {
                writeln(it);
        }
}

Today I learned you can use UFCS with struct literals/constructors.

Reply via email to