On Friday, 27 November 2015 at 11:57:37 UTC, Jonathan M Davis wrote:
Well, you can have a pure input range which is lazy, but what you can't do is wrap it in another lazy range. A prime example would be something like

    auto first5 = range.take(5);
    range.popFront();
    range.popFront();
// first5 now refers to elements 2 through 6 rather than 0 through 4

Hmm well, I think it depends on how you approach the question of what is "correct" there. If range is a RNG then that behaviour could arguably be OK; the 5 numbers extracted from the RNG are evaluated as you consume them, and that's all right.

This is where I'm wishing I knew Haskell better, because I'm increasingly suspecting that InputRanges ought to be thought of in much the same way as Haskell considers IO.

Reply via email to