feat(transducers): add lazy-sequence constructor

This commit is contained in:
fiddlerwoaroof
2020-12-18 22:32:19 -08:00
parent 9ff7f44684
commit cefd4fbab3

View File

@ -101,6 +101,8 @@
(defclass lazy-sequence () (defclass lazy-sequence ()
((%next :initarg :next :reader next))) ((%next :initarg :next :reader next)))
(defun lazy-sequence (next)
(make-instance 'lazy-sequence :next next))
(defmethod reduce-generic ((seq lazy-sequence) (func function) init) (defmethod reduce-generic ((seq lazy-sequence) (func function) init)
(let ((next (next seq))) (let ((next (next seq)))
(loop for next-val = (funcall next) (loop for next-val = (funcall next)