git.fiddlerwoaroof.com
Browse code

feat: allow transducer parts to be past as a list

Edward authored on 04/01/2021 08:50:38
Showing 1 changed files
... ...
@@ -131,7 +131,10 @@
131 131
         ((it) (funcall rf it))))))
132 132
 
133 133
 (defun transduce (xf build seq)
134
-  (let ((transducer (funcall xf (stepper build))))
134
+  (let* ((xf (etypecase xf
135
+               (list (apply 'alexandria:compose xf))
136
+               ((or function symbol) xf)))
137
+         (transducer (funcall xf (stepper build))))
135 138
     (unwrap build
136 139
             (funcall transducer
137 140
                      (catch 'done