I have defined a certain type that can hold arbitrarily many values, and I have already implemented an
iterate() method for it. However, it seems to me that this method allocates all of the iterators elements in memory since it made me implement a
Base.length(MyType) method in order for it to work.
Is there a way in Julia to implement an Iterator that does not allocate its objects in memory until they are needed? Given that I already have an iterator that calculates elements based on the state of it.