|
From: | Michael Heerdegen |
Subject: | bug#30626: 26.0.91; Crash when traversing a `stream-of-directory-files' |
Date: | Sat, 03 Mar 2018 08:56:05 +0100 |
User-agent: | Gnus/5.13 (Gnus v5.13) Emacs/26.0.91 (gnu/linux) |
Nicolas Petton <nicolas@petton.fr> writes: > I had something like the following in mind: > > (cl-defstruct nstream current next-function) > > (cl-defmethod nstream-next ((stream nstream)) > (setf (nstream-current stream) (funcall (nstream-next-function stream) > (nstream-current stream)))) > > (defun nstream-range (&optional start end step) > (unless start (setq start 0)) > (unless step (setq step 1)) > (make-nstream :current start > :next-function (lambda (cur) > (if (equal cur end) > nil > (+ cur step))))) This is an implementation of iterators, not streams. We already have an implementation of iterators in Emacs. Michael.
[Prev in Thread] | Current Thread | [Next in Thread] |