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

Make product iterator iterate in a more natural fashion. #1488

Merged
merged 1 commit into from
Nov 3, 2012
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions extras/iterators.jl
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ function start(it::Product)
end
end
vs = Array(Any, n)
for i = 1:n
for i = n:-1:1
vs[i], js[i] = next(it.xss[i], js[i])
end
return js, vs
Expand All @@ -201,11 +201,11 @@ function next(it::Product, state)
ans = tuple(vs...)

n = length(it.xss)
for i in 1:n
for i in n:-1:1
if !done(it.xss[i], js[i])
vs[i], js[i] = next(it.xss[i], js[i])
break
elseif i == n
elseif i == 1
vs = nothing
break
end
Expand Down