[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: |
Thu, 07 Jul 2016 01:20:49 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.0.95 (gnu/linux) |
Michael Heerdegen <address@hidden> writes:
> Hmm, seems my implementation of `stream-concatenate' is too recursive
> "when executed":
>
> #+begin_src emacs-lisp
> (seq-into-sequence
> (stream-concatenate
> (seq-map
> (lambda (n) (stream (list n)))
> (stream (number-sequence 1 500)))))
>
> stream-empty-p: Lisp nesting exceeds `max-lisp-eval-depth'
> #+end_src
Yes, because with the current definition
#+begin_src emacs-lisp
(defun stream-concatenate (stream-of-streams)
"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)))
#+end_src
when S=s1,s2,s3,..., then
(stream-concatenate S)
will return s a stream that will find its elements like
(stream-append s1 (stream-append s2 (stream-append s3 ...)...))
which can be of arbitrary depth.
Will suggest a patch soon.
Michael.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: [PATCH] Gnu Elpa: stream.el: Add some more basic stream operations,
Michael Heerdegen <=