to compose or hack?

Paul Backus snarwin at gmail.com
Wed Jul 7 20:19:14 UTC 2021


On Wednesday, 7 July 2021 at 19:52:30 UTC, Sebastiaan Koppe wrote:
>
> Just lift each item in a range then:
>
> ```d
> import std;
>
> auto foo(string s, string sp, string j) @nogc {
>      return s.splitter(sp).map!(i => only(i)).joiner(only(j));
> }
> ```

Code golf: `map!(i => only(i))` can be shortened to `map!only`.


More information about the Digitalmars-d-learn mailing list