[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: |
Sun, 25 Sep 2016 17:38:32 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux) |
Yuri Khan <address@hidden> writes:
> You’re right, drop-until is not a good match for this semantics. By
> the way, how would you describe the required behavior without going
> operational (mirroring the implementation)?
If you asking the question implies that you find the semantics not
trivially clear, maybe the following simpler (even superior) approach
would be much better: Add an optional integer type argument to
`seq-drop-while' and `seq-take-while' that allows to shift the index by
the specified amount (as far as possible):
#+begin_src emacs-lisp
(cl-defgeneric seq-drop-while (pred sequence &optional less)
(seq-drop sequence (- (seq--count-successive pred sequence) (or less 0))))
(cl-defgeneric seq-take-while (pred sequence &optional more)
(seq-take sequence (+ (seq--count-successive pred sequence) (or more 0))))
#+end_src
Michael.
- Re: [PATCH] Gnu Elpa: stream.el: Add some more basic stream operations, Michael Heerdegen, 2016/09/16
- Re: [PATCH] Gnu Elpa: stream.el: Add some more basic stream operations, Yuri Khan, 2016/09/17
- Re: [PATCH] Gnu Elpa: stream.el: Add some more basic stream operations,
Michael Heerdegen <=
- Re: [PATCH] Gnu Elpa: stream.el: Add some more basic stream operations, Yuri Khan, 2016/09/25
- Re: [PATCH] Gnu Elpa: stream.el: Add some more basic stream operations, Michael Heerdegen, 2016/09/27
- Re: [PATCH] Gnu Elpa: stream.el: Add some more basic stream operations, Yuri Khan, 2016/09/28
- Re: [PATCH] Gnu Elpa: stream.el: Add some more basic stream operations, Nicolas Petton, 2016/09/28
- Re: [PATCH] Gnu Elpa: stream.el: Add some more basic stream operations, Michael Heerdegen, 2016/09/28
- Re: [PATCH] Gnu Elpa: stream.el: Add some more basic stream operations, Yuri Khan, 2016/09/28
- Re: [PATCH] Gnu Elpa: stream.el: Add some more basic stream operations, John Wiegley, 2016/09/25