Skip to content

Instantly share code, notes, and snippets.

@DNF2
DNF2 / StatefulIterators.jl
Last active November 17, 2015 07:54
A stream-like wrapper around iterable Julia objects. Based on https://github.com/andrewcooke/StatefulIterators.jl
module StatefulIterators_
export StatefulIterator, available, peek, reset!
import Base: eltype, start, next, done, read, copy
type StatefulIterator{T, S}
iter::T
state::S
end
StatefulIterator(itr) = StatefulIterator(itr, start(itr))