v153 · iterator join

Joining a pipeline

A generator, two helpers, a separator, a string. The interesting part is what happens in between — and how many values the source was asked for to produce it.

Run the pipeline

Result


    

The source counts every value it is asked for. Laziness is not decoration: with take(6) over a source of a thousand, the counter should read 6, and it does — the helper stops pulling, and join never asks for more than it needs.

the code being run

see also