{"action":"created","issue":{"url":"https://api.github.com/repos/JuliaLang/julia/issues/11977","labels_url":"https://api.github.com/repos/JuliaLang/julia/issues/11977/labels{/name}","comments_url":"https://api.github.com/repos/JuliaLang/julia/issues/11977/comments","events_url":"https://api.github.com/repos/JuliaLang/julia/issues/11977/events","html_url":"https://github.com/JuliaLang/julia/pull/11977","id":92423723,"number":11977,"title":"RFC: Define `length` methods for various iterators, using `Inf` as length for infinite iterators","user":{"login":"simonbyrne","id":1692009,"avatar_url":"https://avatars.githubusercontent.com/u/1692009?v=3","gravatar_id":"","url":"https://api.github.com/users/simonbyrne","html_url":"https://github.com/simonbyrne","followers_url":"https://api.github.com/users/simonbyrne/followers","following_url":"https://api.github.com/users/simonbyrne/following{/other_user}","gists_url":"https://api.github.com/users/simonbyrne/gists{/gist_id}","starred_url":"https://api.github.com/users/simonbyrne/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/simonbyrne/subscriptions","organizations_url":"https://api.github.com/users/simonbyrne/orgs","repos_url":"https://api.github.com/users/simonbyrne/repos","events_url":"https://api.github.com/users/simonbyrne/events{/privacy}","received_events_url":"https://api.github.com/users/simonbyrne/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/JuliaLang/julia/labels/maths","name":"maths","color":"009800"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":20,"created_at":"2015-07-01T16:12:52Z","updated_at":"2015-07-03T16:04:15Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/JuliaLang/julia/pulls/11977","html_url":"https://github.com/JuliaLang/julia/pull/11977","diff_url":"https://github.com/JuliaLang/julia/pull/11977.diff","patch_url":"https://github.com/JuliaLang/julia/pull/11977.patch"},"body":"See JuliaLang/Iterators.jl#42 for some discussion."},"comment":{"url":"https://api.github.com/repos/JuliaLang/julia/issues/comments/118382363","html_url":"https://github.com/JuliaLang/julia/pull/11977#issuecomment-118382363","issue_url":"https://api.github.com/repos/JuliaLang/julia/issues/11977","id":118382363,"user":{"login":"simonbyrne","id":1692009,"avatar_url":"https://avatars.githubusercontent.com/u/1692009?v=3","gravatar_id":"","url":"https://api.github.com/users/simonbyrne","html_url":"https://github.com/simonbyrne","followers_url":"https://api.github.com/users/simonbyrne/followers","following_url":"https://api.github.com/users/simonbyrne/following{/other_user}","gists_url":"https://api.github.com/users/simonbyrne/gists{/gist_id}","starred_url":"https://api.github.com/users/simonbyrne/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/simonbyrne/subscriptions","organizations_url":"https://api.github.com/users/simonbyrne/orgs","repos_url":"https://api.github.com/users/simonbyrne/repos","events_url":"https://api.github.com/users/simonbyrne/events{/privacy}","received_events_url":"https://api.github.com/users/simonbyrne/received_events","type":"User","site_admin":false},"created_at":"2015-07-03T16:04:15Z","updated_at":"2015-07-03T16:04:15Z","body":"The main purpose of this PR is to draw a distinction between:\r\n* iterators with infinite length\r\n* iterators with unknown (but typically finite) length\r\n\r\nThe reason is that they act in a very different way: when used in `zip`, `take`, etc, infinite length iterators will have a known length, and so can be used in comprehensions. To take an example: suppose that `convergents(pi)` is an iterator over the convergents of pi. Then I can calculate the error of the first 10 convergents via\r\n```julia\r\n[abs(c - big(pi)) for c in take(convergents(pi),10)]\r\n```\r\n\r\nOn the other hand the output of `filter` has an unknown length, and so applying `take` to this will still have an unknown length, and hence can't be used in a comprehension.\r\n"}}