Alexander Blinne <n...@blinne.net> writes:
> An Element of s could be discarded, after every one of the three (k*j
> for k in s)-generators went over it. I don't think that this is possible
> with one deque (at least with the built-in merger of heapq, a
> self-written one could be adapted). Storing everything three times (one
> deque for every generator) would be a mess as well.

I think for 3 lists I'd have just merged manually instead of figuring
out the heapq merge.  The deque approach sounds straightforward but
often there is subtlety, so I'll have to try it.

> How do Haskell or Scheme determine when elements are not longer needed?

Normal gc, once there is no reference to an elemeent it is released.
Actually again there may be a subtlety, if there is a symbol pointing
to the stream.  I'll check into this but I think when I tested it in
Haskell, it did the right thing.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to