emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Elpa: Pinpoint semantics of `seq-subseq' for streams


From: John Wiegley
Subject: Re: [PATCH] Elpa: Pinpoint semantics of `seq-subseq' for streams
Date: Tue, 13 Sep 2016 18:28:22 -0700
User-agent: Gnus/5.130014 (Ma Gnus v0.14) Emacs/25.1 (darwin)

>>>>> "MH" == Michael Heerdegen <address@hidden> writes:

HM> Yes, I want to forbid them, unless there are realistic use cases. No, we
HM> don't have something like `tail' for streams. If you want something like
MH> that, you are in general better done with lists (i.e. convert the stream
HM> into a list), I think.

You could implement tail as a stream adapter that basically implements a
sliding window:

  Whenever an element is requested from the tail stream, it keeps requesting
  elements from the parent stream, filling up its window buffer and cycling
  out old elements, until it reaches the end of the parent stream.  At that
  point, it knows enough to start draining the window buffer to the caller.

It "forces" the parent stream, but provides the requested behavior for those
who might prefer a streams interface.  Also, the forcing of the parent stream
can be delayed until at least one element is requested.

-- 
John Wiegley                  GPG fingerprint = 4710 CF98 AF9B 327B B80F
http://newartisans.com                          60E1 46C4 BD1A 7AC1 4BA2



reply via email to

[Prev in Thread] Current Thread [Next in Thread]