Skip to content

Commit

Permalink
iterator protocol fix
Browse files Browse the repository at this point in the history
  • Loading branch information
dysonance committed Dec 3, 2018
1 parent fdca7ef commit 4c1ed3a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/ts.jl
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ length(x::TS) = prod(size(x))::Int
lastindex(x::TS) = lastindex(x.values)
lastindex(x::TS, d) = lastindex(x.values, d)
iterate(x::TS) = size(x,1) == 0 ? nothing : (x.index[1], x.values[1,:]), 2
iterate(x::TS, i::Int) = i == lastindex(x, 1) ? nothing : ((x.index[i], x.values[i,:]), i+1)
iterate(x::TS, i::Int) = i == lastindex(x, 1) + 1 ? nothing : ((x.index[i], x.values[i,:]), i+1)
isempty(x::TS) = (isempty(x.index) && isempty(x.values))
first(x::TS) = x[1]
last(x::TS) = x[end]
Expand Down

1 comment on commit 4c1ed3a

@scls19fr
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Closes #34

Please sign in to comment.