Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

not-nested for loop causes UndefVarError: #temp# not defined #14

Closed
goretkin opened this issue Jan 17, 2018 · 1 comment · Fixed by #100
Closed

not-nested for loop causes UndefVarError: #temp# not defined #14

goretkin opened this issue Jan 17, 2018 · 1 comment · Fixed by #100

Comments

@goretkin
Copy link

on ResumableFunctions 0.1.10 and julia 0.6.2

using ResumableFunctions

@resumable function gen(n)
  for i=1:n, j=1:n
    @yield i
  end
end

collect(gen(10))

gives

ERROR: UndefVarError: #temp# not defined
Stacktrace:
 [1] (::##688)(::Void) at /home/ubuntu/.julia/v0.6/MacroTools/src/utils.jl:2
 [2] _collect(::UnitRange{Int64}, ::##688, ::Base.HasEltype, ::Base.SizeUnknown) at ./array.jl:442
 [3] collect(::##688) at ./array.jl:431
@BenLauwens
Copy link
Collaborator

BenLauwens commented Jan 22, 2018

Hi

Multiple iterators in a for statement are not (yet) implemented!
Your code can be executed as:

using ResumableFunctions

@resumable function gen(n)
  for i=1:n
    for j=1:n
      @yield i
    end
  end
end

collect(gen(10))

I will put this on my todo list;)

Regards

Ben

@thofma thofma mentioned this issue Aug 10, 2024
9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants