I wonder what is the correct way to create objects that are iterable (or broadcastable?). The code below works as expected.
struct A x::Float64 y::Float64 end function foo(n,m,s::A) u = n^2 + s.x^2 v = m + s.y return u,v end a = A(1,2) u,v = foo(4,5,a)
However now I would like to be able to pass vectors to foo so it can also return vectors eg:
x = collect(1:10) y = collect(2:11) u,v = foo.(x,y,a)
Note here that ‘a’ is still a single object of type ‘A’. I have tried to extend length and iterate among others but to no avail. Thanks!