[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 6bb5fee: * stream.el: Implement `seqp' instead of `seq-p'
From: |
Nicolas Petton |
Subject: |
[elpa] master 6bb5fee: * stream.el: Implement `seqp' instead of `seq-p' |
Date: |
Wed, 11 Nov 2015 17:34:31 +0000 |
branch: master
commit 6bb5feef7bd7c91a97bba1658fa4874aa5df5e89
Author: Nicolas Petton <address@hidden>
Commit: Nicolas Petton <address@hidden>
* stream.el: Implement `seqp' instead of `seq-p'
---
packages/stream/stream.el | 12 ++++++++++--
1 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/packages/stream/stream.el b/packages/stream/stream.el
index 61d99ee..edfb3c5 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.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)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [elpa] master 6bb5fee: * stream.el: Implement `seqp' instead of `seq-p',
Nicolas Petton <=