Skip to content

Commit

Permalink
Fix enumerate of product
Browse files Browse the repository at this point in the history
  • Loading branch information
tkf committed Jan 28, 2021
1 parent 93a247f commit a793d62
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/implementations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ shape(xs::Iterators.Enumerate) = shape(xs.itr)

function halve(xs::Iterators.Enumerate)
left, right = halve(xs.itr)
return enumerate(left), zip(length(left)+1:length(xs), right)
return enumerate(left), zip(reshape(length(left)+1:length(xs), size(right)), right)
end

function halve(xs::Iterators.Reverse)
Expand Down
1 change: 1 addition & 0 deletions test/test_halve.jl
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ partition(1:10, 3)
partition(1:10, 4)
enumerate([11, 22, 33, 44])
enumerate([11, 22, 33, 44, 55])
enumerate(Iterators.product(1:3, 'a':'b'))
zip(1:3, partition(1:10, 4))
zip("αβγ")
zip(enumerate([11, 22, 33, 44]), 'a':'d')
Expand Down

0 comments on commit a793d62

Please sign in to comment.