Lazily takes only up to n elements of a stream.
import std.algorithm : equal; import std.range : iota; assert([ 1, 2, 4, 8, 16 ].take(3)[].equal([ 1, 2, 4 ])); assert(iota(31337).take(1024)[].equal(iota(1024)));
See Implementation
Lazily takes only up to n elements of a stream.