emacs-devel
[Top][All Lists]
Advanced

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

Re: [PATCH] Gnu Elpa: stream.el: Add some more basic stream operations


From: Michael Heerdegen
Subject: Re: [PATCH] Gnu Elpa: stream.el: Add some more basic stream operations
Date: Sat, 17 Sep 2016 01:52:25 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux)

Yuri Khan <address@hidden> writes:

> > Would it make sense to add an `seq-take-until' for convenience?
>
> seq-take-until might be a fitting addition to seq-take-while.
> seq-drop-until, for completeness?

Hmm, isn't `seq-drop-until' redundant - because it's the same as
`seq-drop-while' with negated predicate?

For example, if stream

  S = 0, 0, ..., 0, 1, 2, 3, ...

then naturally would

  (seq-drop-while #'zerop S) == 1, 2, ...
                             == (seq-drop-until
                                  (lambda (n) (not (zerop n)))
                                   S)

`seq-take-until' is obviously not redundant in the same way.  So, why is
the symmetry broken?  I think the problem is the wording:
`seq-drop-until' is simply not the natural counterpart of
`seq-drop-while'.

We would want a function seq-X so that

  (seq-X #'zerop S) == 0, 1, 2, ...

I think that this function would be useful (I already needed it).  But
what word sequence X would describe these semantics (how should we call
the function)?


Michael.



reply via email to

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