mirror of
https://github.com/fiddlerwoaroof/data-lens.git
synced 2025-11-08 10:16:32 +00:00
feat: add collecting transducer to accumulate partial sums
This commit is contained in:
@ -86,6 +86,18 @@
|
||||
(funcall rf it last)
|
||||
it)))))))
|
||||
|
||||
|
||||
(defun collecting (collector)
|
||||
(lambda (rf)
|
||||
(let (sofar)
|
||||
(transducer-lambda
|
||||
((acc next)
|
||||
(if sofar
|
||||
(setf sofar (funcall collector sofar next))
|
||||
(setf sofar next))
|
||||
(funcall rf acc sofar))))))
|
||||
|
||||
|
||||
(defun deduping (&optional (test 'eql))
|
||||
(compressing-runs :test test))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user