[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/stream daa19594e7 3/7: Add generalized variables for st
From: |
Stefan Monnier |
Subject: |
[elpa] externals/stream daa19594e7 3/7: Add generalized variables for streams that error when used. |
Date: |
Sun, 17 Nov 2024 21:15:42 -0500 (EST) |
branch: externals/stream
commit daa19594e7058ae531ec611b067fb970353b0e7c
Author: Earl Hyatt <okamsn@protonmail.com>
Commit: Stefan Monnier <monnier@iro.umontreal.ca>
Add generalized variables for streams that error when used.
* stream.el (seq-elt, stream-first, stream-rest): Signal an error when
trying to
use this function as a place for 'setf'.
---
stream.el | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/stream.el b/stream.el
index 300f3b8ae2..dea42b4962 100644
--- a/stream.el
+++ b/stream.el
@@ -290,6 +290,10 @@ range is infinite."
Return nil if STREAM is empty."
(stream--first (stream--force stream)))
+(defun \(setf\ stream-first\) (_store _stream)
+ "Signal an error when trying to use `setf' on the head of a stream."
+ (error "Streams are not mutable"))
+
(defun stream-rest (stream)
"Return a stream of all but the first element of STREAM."
(setq stream (stream--force stream))
@@ -297,6 +301,10 @@ Return nil if STREAM is empty."
(stream-empty)
(stream--rest stream)))
+(defun \(setf\ stream-rest\) (_store _stream)
+ "Signal an error when trying to use `setf' on the tail of a stream."
+ (error "Streams are not mutable"))
+
(defun stream-append (&rest streams)
"Concatenate the STREAMS.
Requesting elements from the resulting stream will request the
@@ -337,6 +345,9 @@ elements in the STREAMS in order."
(setq n (1- n)))
(stream-first stream))
+(cl-defmethod (setf seq-elt) (_store (_sequence stream) _n)
+ (error "Streams are not mutable"))
+
(cl-defmethod seq-length ((stream stream))
"Return the length of STREAM.
This function will eagerly consume the entire stream."
- [elpa] externals/stream updated (5c0ffd088f -> 1e3c1436cc), Stefan Monnier, 2024/11/17
- [elpa] externals/stream b2f650a8a6 4/7: Add an implementation of `seq-concatenate` for streams., Stefan Monnier, 2024/11/17
- [elpa] externals/stream 0ad03f585b 5/7: Add test for delayed evaluation for seq-drop-while for streams., Stefan Monnier, 2024/11/17
- [elpa] externals/stream daa19594e7 3/7: Add generalized variables for streams that error when used.,
Stefan Monnier <=
- [elpa] externals/stream 1e3c1436cc 7/7: Shorten the documentation strings of seq-take-while and seq-drop-while., Stefan Monnier, 2024/11/17
- [elpa] externals/stream bd614d022b 2/7: Add more efficient method for making streams from arrays., Stefan Monnier, 2024/11/17
- [elpa] externals/stream f48552c066 1/7: Change 'stream.el' to use structures instead of cons cells., Stefan Monnier, 2024/11/17
- [elpa] externals/stream 202db1e4b5 6/7: Fix the quoting in the documentation of `seq-mapn` for streams., Stefan Monnier, 2024/11/17