SimpleIterator.jl is a Julia package that provides a simple Python-like iterator interface for Julia.
It enables the iteration of an object x
becomes iteration over iterator(x)
.
The iteration behavior can be easily customized by overloading the iterator
function and returning the desired iterator object.
struct MyType
data::Vector{Int}
end
@iterfn iterator(x::MyType) = x.data
for i in MyType([1, 2, 3])
@show i
end
] add SimpleIterator