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

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

[elpa] externals/stream 1a61660 11/36: * stream.el: Implement `seqp' ins


From: Stefan Monnier
Subject: [elpa] externals/stream 1a61660 11/36: * stream.el: Implement `seqp' instead of `seq-p'
Date: Tue, 1 Dec 2020 17:22:48 -0500 (EST)

branch: externals/stream
commit 1a616604e1a406f56c49ed895c29825393723398
Author: Nicolas Petton <nicolas@petton.fr>
Commit: Nicolas Petton <nicolas@petton.fr>

    * stream.el: Implement `seqp' instead of `seq-p'
---
 stream.el | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/stream.el b/stream.el
index 61d99ee..edfb3c5 100644
--- a/stream.el
+++ b/stream.el
@@ -4,7 +4,7 @@
 
 ;; Author: Nicolas Petton <nicolas@petton.fr>
 ;; Keywords: stream, laziness, sequences
-;; Version: 2.0.5
+;; Version: 2.1.0
 ;; Package-Requires: ((emacs "25"))
 ;; Package: stream
 
@@ -156,6 +156,14 @@ range is infinite."
   "Return a stream of all but the first element of STREAM."
   (or (cdr (thunk-force (cadr stream)))
       (stream-empty)))
+
+(defmacro stream-pop (stream)
+  "Return the first element of STREAM and set the value of STREAM to its rest."
+  (unless (symbolp stream)
+    (error "STREAM must be a symbol"))
+  `(prog1
+       (stream-first ,stream)
+     (setq ,stream (stream-rest ,stream))))
 
 
 ;;; cl-generic support for streams
@@ -176,7 +184,7 @@ range is infinite."
 
 ;;; Implementation of seq.el generic functions
 
-(cl-defmethod seq-p ((_stream stream))
+(cl-defmethod seqp ((_stream stream))
   t)
 
 (cl-defmethod seq-elt ((stream stream) n)



reply via email to

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