I want to find whether a Structure of Type A is in included in A Collection. In the next step I wanna return this collection form a Collection of a Collection of Type A^^.
struct A
a = Int
end
a = [A(1), A(2)]
in(a, A(1))
This throws the Error:
ERROR: MethodError: no method matching iterate(::A)
Closest candidates are:
iterate(::Union{LinRange, StepRangeLen}) at ~/packages/julias/julia-1.7/share/julia/base/range.jl:826
iterate(::Union{LinRange, StepRangeLen}, ::Integer) at ~/packages/julias/julia-1.7/share/julia/base/range.jl:826
iterate(::T) where T<:Union{Base.KeySet{<:Any, <:Dict}, Base.ValueIterator{<:Dict}} at ~/packages/julias/julia-1.7/share/julia/base/dict.jl:695
...
Stacktrace:
[1] in(x::Vector{A}, itr::A)
@ Base ./operators.jl:1282
[2] top-level scope
@ REPL[6]:1
I assume I have to implement an iterate function?! How is this done? What needs to be returned?