emacs-devel
[Top][All Lists]
Advanced

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

[PATCH Elpa] Fix errors detected by tests added in last commit (was: [PA


From: Michael Heerdegen
Subject: [PATCH Elpa] Fix errors detected by tests added in last commit (was: [PATCH Elpa: streams.el] Add systematic tests against bogus element generation)
Date: Fri, 23 Sep 2016 17:22:26 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux)

I <address@hidden> wrote:

> The patch fixing the detected errors will come soon.

Ok, here is the (quite trivial) fix.


Regards,

Michael.


>From e41db042aadec660fbc0736f416a6f0aabfd1602 Mon Sep 17 00:00:00 2001
From: Michael Heerdegen <address@hidden>
Date: Sat, 17 Sep 2016 15:42:45 +0200
Subject: [PATCH] Fix errors detected by tests added in last commit

---
 packages/stream/stream.el | 33 ++++++++++++++++-----------------
 1 file changed, 16 insertions(+), 17 deletions(-)

diff --git a/packages/stream/stream.el b/packages/stream/stream.el
index ef19918..9a7f664 100644
--- a/packages/stream/stream.el
+++ b/packages/stream/stream.el
@@ -4,7 +4,7 @@
 
 ;; Author: Nicolas Petton <address@hidden>
 ;; 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.
-- 
2.9.3


reply via email to

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