I am writing some iterators that work with `IO`.
I thought, so that my iterators would not mutate,
I would `deepcopy` the IO item, and store it as part of my state.
(then only my state would mutate, and no-one cares probably (unless they
were trying to `tee` for free))
But `deepcopying` IO items apparently does not actually cause them to
become separate.
At least not for IOStreams.
io=open("./data/text8/text8","r")
ia = deepcopy(io)
>IOStream(<file ./data/text8/text8>)
position(io)
>0
position(seekend(io))
>100000000
position(ia)
>100000000
I was under the assumption that iterators never mutated, as there is no `!`
in `next`.
(then again there is also no `!` in `seekend`)
So I was a bit stuck for how to implement.
So I thought I would see how `Eachline` is implemented.
<https://github.com/JuliaLang/julia/blob/master/base/io.jl#L356>
It is mutating.
So maybe my assumptions are wrong, and iterators can be mutating?
They would be a lot easier to write that way, I guess.
But julia does not have a `tee` function
<https://docs.python.org/2/library/itertools.html#itertools.tee>