http://www.perlmonks.org?node_id=440892


in reply to Re^3: Challenge: Another Infinite Lazy List
in thread Challenge: Another Infinite Lazy List

Hmm. My variation uses the @v array to store the next value that would come from a given stream, and the @f array to store what value a given stream is incremented by when a value is "popped" from it. When it comes time to return the next value in the sequence the lowest value available is "popped" from the streams. If it could have also come from a stream with a smaller factor it is ignored and the process repeats otherwise the popped value is returned.

As far as I can tell this is basically the same thing as yours, except you multiply and I increment, and the way we handle dupes is slighlty different but the principle is the same. Its just interesting to me, I find the way identical algorithms can look so different at first glance to be fascinating.

---
demerphq