;; Author: Nicolas Petton <nicolas@petton.fr>
;; Keywords: stream, laziness, sequences
-;; Version: 1.0.1
+;; Version: 1.1.0
;; Package-Requires: ((emacs "25"))
;; Package: stream
(defun stream-rest (stream)
"Return a stream of all but the first element of STREAM."
- (cdr (stream--force (cadr stream))))
+ (or (cdr (stream--force (cadr stream)))
+ (stream-empty)))
\f
;;; cl-generic support for streams
(cl-defmethod seq-take ((stream stream) n)
"Return a stream of the first N elements of STREAM."
- (if (zerop n)
+ (if (or (zerop n)
+ (stream-empty-p stream))
(stream-empty)
(stream-cons
(stream-first stream)