[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: |
Mon, 01 Aug 2016 23:13:50 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) |
Michael Heerdegen <address@hidden> writes:
> Will suggest a patch soon.
Ok, I've not found a better solution than in my first patch, but I think
it was ok (solved the problem, and speed seems to be ok too).
So I only fixed that its implementation of `stream-concatenate' was only
partly delayed. And this is the result...ok to install? Thanks.
>From 6eab42aca0276eb2a534c32a272532d023163824 Mon Sep 17 00:00:00 2001
From: Michael Heerdegen <address@hidden>
Date: Sun, 17 Jul 2016 00:41:13 +0200
Subject: [PATCH] Avoid recursive stream-append in stream-concatenate
This fix prevents exceeding `max-lisp-eval-depth' for streams returned
by stream-concatenate.
---
packages/stream/stream.el | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/packages/stream/stream.el b/packages/stream/stream.el
index 8b71a1b..853251e 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.0
+;; Version: 2.2.1
;; Package-Requires: ((emacs "25"))
;; Package: stream
@@ -377,7 +377,17 @@ will be found by calling FUNCTION on the preceding
element."
"Concatenate all streams in STREAM-OF-STREAMS and return the result.
All elements in STREAM-OF-STREAMS must be streams. The result is
a stream."
- (seq-reduce #'stream-append stream-of-streams (stream-empty)))
+ (stream-make
+ (while (and (not (stream-empty-p stream-of-streams))
+ (stream-empty-p (stream-first stream-of-streams)))
+ (cl-callf stream-rest stream-of-streams))
+ (if (stream-empty-p stream-of-streams)
+ nil
+ (cons
+ (stream-first (stream-first stream-of-streams))
+ (stream-concatenate
+ (stream-cons (stream-rest (stream-first stream-of-streams))
+ (stream-rest stream-of-streams)))))))
(defun stream-of-directory-files-1 (directory &optional nosort recurse
follow-links)
"Helper for `stream-of-directory-files'."
--
2.8.1
Regards,
Michael.
- Re: [PATCH] Gnu Elpa: stream.el: Add some more basic stream operations,
Michael Heerdegen <=