An implementation using xstream. Note how there is no state as such in Cycle, only a bunch of streams!
xstream