JuliaLang/julia — pull request #672 by dcjones (2012-04-05 22:10:48+00:00)
Title: Define a length function over iterators.

This is a generic `length` function that iterates an iterator and counts the number of elements, to make more convenient things like

num_matches = length(each_match(pattern, x))

The slight downside of having a `length(Any,)` is slightly more cryptic error messages in some cases:

> length(nothing)
no method start(Nothing,)
in method_missing at base.jl:60
in length at iterator.jl:4