Tortoises, Teleporting Turtles, and Iterators
github.com
github.com
Thank you - significantly improved my day.
Added in edit
It's always bugged me that the top comment on the original HN thread about the Teleporting Turtle claims that the pseudo-code has a bug, and then subsequent, under-the-fold discussions realise that the code is correct.