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: Michael Heerdegen
Subject: Re: [PATCH] Elpa: Pinpoint semantics of `seq-subseq' for streams
Date: Tue, 13 Sep 2016 23:17:00 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux)

Hi Clément,

> On 2016-09-13 12:23, Michael Heerdegen wrote:
> > - Forbid negative index arguments.
>
> Do you really want to forbid negative arguments? Do we have a function
> akin to `tail' for streams (something that would return the last n
> elements?

Thanks for your feedback!

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

Streams are delayed.  In general, you don't know how many (or if any at
all) elements a stream will generate later.  All functions building
streams out of argument streams are not allowed to generate any elements
from any input stream.

Negative indexes for `seq-subseq' would still be possible without
breaking these rules - but you would probably not need the result to be
a stream anyway (instead of a list, for example).  Streams are a mean to
program in a certain way (called data flow control or something like
that).  Negative indexes for `seq-subseq' collide with this model.

That's why I thought it's better to forbid negative indexes for now.  If
I see an example where it is really useful and appropriate, or good
arguments against this decision, I'll change my mind.


Regards,

Michael.



reply via email to

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