I’m trying to wrap a C library where iteration is intrinsically non-stateful, as shown below.
void *y = ...;
void *x = start_iteration(y);
while (x!=NULL) {
do_something(x);
x = get_next(y);
}
I was wondering if anyone has any advice on how to (elegantly) wrap this iteration pattern with the Julia iteration protocol, where there doesn’t seem to be a natural definition of state as in http://docs.julialang.org/en/release-0.5/manual/interfaces/