Skip to content

Commit

Permalink
Implement iterate properly
Browse files Browse the repository at this point in the history
  • Loading branch information
Sagnac committed Jun 1, 2023
1 parent 01e269b commit 83274dd
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/WavefrontError.jl
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ end
getindex(W::T, i) where {T <: WavefrontOutput} = getfield(W, fieldnames(T)[i])

# hook into iterate to allow non-property destructuring of the output
iterate(W::WavefrontOutput, i = 1) = (W[i], i + 1)
iterate(W::WavefrontOutput, i = 1) = (i > 4 ? nothing : (W[i], i + 1))

# methods
function W::Vector, θ::Vector, OPD::Vector, n_max::Int, ::Model; precision = 3)
Expand Down
2 changes: 1 addition & 1 deletion src/Zernike.jl
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ show(::IO, ::Output) = nothing
getindex(Z::T, i) where {T <: Output} = getfield(Z, fieldnames(T)[i])

# hook into iterate to allow non-property destructuring of the output
iterate(Z::Output, i = 1) = (Z[i], i + 1)
iterate(Z::Output, i = 1) = (i > 3 ? nothing : (Z[i], i + 1))

# methods
function Z(m::Int, n::Int, ::Model)
Expand Down

0 comments on commit 83274dd

Please sign in to comment.