{"action":"created","issue":{"url":"https://api.github.com/repos/one-more-minute/Lazy.jl/issues/30","labels_url":"https://api.github.com/repos/one-more-minute/Lazy.jl/issues/30/labels{/name}","comments_url":"https://api.github.com/repos/one-more-minute/Lazy.jl/issues/30/comments","events_url":"https://api.github.com/repos/one-more-minute/Lazy.jl/issues/30/events","html_url":"https://github.com/one-more-minute/Lazy.jl/issues/30","id":108584112,"number":30,"title":"Error with seq(itr)","user":{"login":"boathit","id":4621261,"avatar_url":"https://avatars.githubusercontent.com/u/4621261?v=3","gravatar_id":"","url":"https://api.github.com/users/boathit","html_url":"https://github.com/boathit","followers_url":"https://api.github.com/users/boathit/followers","following_url":"https://api.github.com/users/boathit/following{/other_user}","gists_url":"https://api.github.com/users/boathit/gists{/gist_id}","starred_url":"https://api.github.com/users/boathit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/boathit/subscriptions","organizations_url":"https://api.github.com/users/boathit/orgs","repos_url":"https://api.github.com/users/boathit/repos","events_url":"https://api.github.com/users/boathit/events{/privacy}","received_events_url":"https://api.github.com/users/boathit/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-09-28T03:45:29Z","updated_at":"2015-10-01T14:41:16Z","closed_at":null,"body":"`seq(itr)` will throw an error when applying to an iterator, such as \r\n```\r\nLazy.seq(1:5)\r\n\r\nError showing value of type Lazy.LazyList:\r\nERROR: UndefVarError: x not defined\r\n [inlined code] from /Users/fineday/.julia/v0.4/Lazy/src/macros.jl:214\r\n in anonymous at /Users/fineday/.julia/v0.4/Lazy/src/Lazy.jl:82\r\n in isempty at /Users/fineday/.julia/v0.4/Lazy/src/Lazy.jl:78\r\n in writemime at /Users/fineday/.julia/v0.4/Lazy/src/Lazy.jl:128\r\n in display at REPL.jl:115\r\n in display at REPL.jl:118\r\n [inlined code] from multimedia.jl:151\r\n...\r\n```\r\n\r\nI traced the error to the function `seq(itr, state)` and it seems the error originates from the definition of macro `@with`, because when rewriting the `seq(itr, state)` like \r\n```\r\nseq(itr, state) = \r\n    @lazy done(itr, state) ? [] :\r\n        begin x, state = next(itr, state)\r\n            prepend(x, seq(itr, state))\r\n        end\r\n```\r\nthe error disappears both `seq(1:5)` and `seq(take([1,2,3,4,5], 3)` works well"},"comment":{"url":"https://api.github.com/repos/one-more-minute/Lazy.jl/issues/comments/144748507","html_url":"https://github.com/one-more-minute/Lazy.jl/issues/30#issuecomment-144748507","issue_url":"https://api.github.com/repos/one-more-minute/Lazy.jl/issues/30","id":144748507,"user":{"login":"boathit","id":4621261,"avatar_url":"https://avatars.githubusercontent.com/u/4621261?v=3","gravatar_id":"","url":"https://api.github.com/users/boathit","html_url":"https://github.com/boathit","followers_url":"https://api.github.com/users/boathit/followers","following_url":"https://api.github.com/users/boathit/following{/other_user}","gists_url":"https://api.github.com/users/boathit/gists{/gist_id}","starred_url":"https://api.github.com/users/boathit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/boathit/subscriptions","organizations_url":"https://api.github.com/users/boathit/orgs","repos_url":"https://api.github.com/users/boathit/repos","events_url":"https://api.github.com/users/boathit/events{/privacy}","received_events_url":"https://api.github.com/users/boathit/received_events","type":"User","site_admin":false},"created_at":"2015-10-01T14:41:16Z","updated_at":"2015-10-01T14:41:16Z","body":"Hi Mike, A PR has been submitted, but it needs to point out that currently `let x, y = next(1:5, start(1:5)) end` cannot be deconstructed correctly in Julia, the value of `y` will be a tuple `(1,2)` and `x` will not be defined. That's the reason why `seq(itr)` fails to work previously as the `let` expression is used in macro `@with`."}}