JuliaLang/Iterators.jl — pull request #28 by kmsquire (2014-07-06 07:01:34+00:00)
Title: Parametrize iterators based on applicable(length, it.xs); fixes #25

Some iterators wrap other iterators, and the wrapped iterable may or may not have a defined length. This PR parametrizes the relevant iterator types based on whether or not `length` is defined for the wrapped iterable, and defines `length` for the iterator only when the wrapped array also has a length.

This is most useful for `collect(itr)`, which preallocates an output array if `length` is defined, or grows the output array otherwise.

Cc: @garborg, @ivarne

Ref: https://github.com/JuliaLang/julia/issues/7429, #25, #27