emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] externals/stream 873ee4e 23/36: Fix errors detected by tests adde


From: Stefan Monnier
Subject: [elpa] externals/stream 873ee4e 23/36: Fix errors detected by tests added in last commit
Date: Tue, 1 Dec 2020 17:22:51 -0500 (EST)

branch: externals/stream
commit 873ee4e2186e99c7e5c0a4aaf8a6dc5ee261320e
Author: Michael Heerdegen <michael_heerdegen@web.de>
Commit: Michael Heerdegen <michael_heerdegen@web.de>

    Fix errors detected by tests added in last commit
---
 stream.el | 33 ++++++++++++++++-----------------
 1 file changed, 16 insertions(+), 17 deletions(-)

diff --git a/stream.el b/stream.el
index ef19918..9a7f664 100644
--- a/stream.el
+++ b/stream.el
@@ -4,7 +4,7 @@
 
 ;; Author: Nicolas Petton <nicolas@petton.fr>
 ;; Keywords: stream, laziness, sequences
-;; Version: 2.2.2
+;; Version: 2.2.3
 ;; Package-Requires: ((emacs "25"))
 ;; Package: stream
 
@@ -273,12 +273,13 @@ stream will simply be accordingly shorter, or even 
empty)."
 
 (cl-defmethod seq-take ((stream stream) n)
   "Return a stream of the first N elements of STREAM."
-  (if (or (zerop n)
-          (stream-empty-p stream))
-      (stream-empty)
-    (stream-cons
-     (stream-first stream)
-     (seq-take (stream-rest stream) (1- n)))))
+  (stream-make
+   (if (or (zerop n)
+           (stream-empty-p stream))
+       nil
+     (cons
+      (stream-first stream)
+      (seq-take (stream-rest stream) (1- n))))))
 
 (cl-defmethod seq-drop ((stream stream) n)
   "Return a stream of STREAM without its first N elements."
@@ -327,16 +328,14 @@ kind of nonlocal exit."
 
 (cl-defmethod seq-filter (pred (stream stream))
   "Return a stream of the elements for which (PRED element) is non-nil in 
STREAM."
-  (if (stream-empty-p stream)
-      stream
-    (stream-make
-     (while (not (or (stream-empty-p stream)
-                     (funcall pred (stream-first stream))))
-       (setq stream (stream-rest stream)))
-     (if (stream-empty-p stream)
-         nil
-       (cons (stream-first stream)
-             (seq-filter pred (stream-rest stream)))))))
+  (stream-make
+   (while (not (or (stream-empty-p stream)
+                   (funcall pred (stream-first stream))))
+     (setq stream (stream-rest stream)))
+   (if (stream-empty-p stream)
+       nil
+     (cons (stream-first stream)
+           (seq-filter pred (stream-rest stream))))))
 
 (defmacro stream-delay (expr)
   "Return a new stream to be obtained by evaluating EXPR.



reply via email to

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