mirror of
https://github.com/fiddlerwoaroof/data-lens.git
synced 2025-11-08 18:26:32 +00:00
feat(transducers): add lazy-sequence constructor
This commit is contained in:
@ -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)
|
||||||
|
|||||||
Reference in New Issue
Block a user