A lazy-chain for std.range?
Mint via Digitalmars-d
digitalmars-d at puremagic.com
Fri Feb 26 20:47:48 PST 2016
On Saturday, 27 February 2016 at 04:37:26 UTC, Jakob Ovrum wrote:
> With std.typecons.Option[1] it becomes:
>
> return elements
> .map!(…)
> .filter!(…)
> .frontOption
> .getOrElse(fallback);
>
> `fallback` is a lazy argument.
>
> [1] https://github.com/D-Programming-Language/phobos/pull/3915
Cool. I'll have to look this over. Mostly because having a
function that takes a lazy range is also important for some of
the stuff I'm doing.
My only concern is how fragmented the std lib is becoming. Range
related functions in std.algo, std.array, std.range, and now
std.typecons (which std.variant is separate from, for whatever
reason). Regardless, that's a different discussion in and of
itself.
More information about the Digitalmars-d
mailing list