collection |> Take(n) could still know about its length. Not because of Take(n) alone but because the input reducible may also knows its length. If there is no transducer that modifies the length depending on the input data, one should still be able to compute the length of the whole pipeline without materializing it; in this example the Take transducer could simply return min(length(collection), n).
To my surprise, a transducer using
Take
does not know its size, even if there are noFilter
calls in the pipeline:collection |> Take(n)
could still know about its length. Not because ofTake(n)
alone but because the input reducible may also knows its length. If there is no transducer that modifies the length depending on the input data, one should still be able to compute the length of the whole pipeline without materializing it; in this example theTake
transducer could simply returnmin(length(collection), n)
.