Why does choose not work here

Matt gamblemj at gmail.com
Thu Aug 1 21:26:10 UTC 2019


On Thursday, 1 August 2019 at 21:12:51 UTC, ag0aep6g wrote:
> `choose`'s parameters aren't lazy. So the second argument is 
> evaluated even when `previous is null`. That means 
> `intervalRange` is called on a null `previous`. And that fails, 
> of course, because `intervalRange` can't access `starts` or 
> `stops` when `this` is null.

I forgot about lazy parameters. I tried changes myFilters second 
parameter to lazy, but that didn't help. So I guess I'm stuck 
with the "if" version using the ForwardRange interface (version 
2)? Anyone have any other thoughts?


More information about the Digitalmars-d-learn mailing list