git.fiddlerwoaroof.com
Browse code

feat(utils): use FUNCTIONALIZE in data-lens. Slightly incompatible

Edward authored on 31/12/2020 06:08:03
Showing 1 changed files
... ...
@@ -248,8 +248,9 @@
248 248
              :initial-value ()))))
249 249
 
250 250
 (defun-ct over (fun &key (result-type 'list))
251
-  (lambda (seq)
252
-    (map result-type fun seq)))
251
+  (let ((fun (functionalize fun)))
252
+    (lambda (seq)
253
+      (map result-type fun seq))))
253 254
 
254 255
 (defun-ct denest (&key (result-type 'list))
255 256
   (lambda (seq)
... ...
@@ -257,13 +258,16 @@
257 258
            seq)))
258 259
 
259 260
 (defmacro applying (fun &rest args)
260
-  (alexandria:with-gensyms (seq)
261
-    `(lambda (,seq)
262
-       (apply ,fun ,@args ,seq))))
261
+  (alexandria:with-gensyms (seq fsym)
262
+    `(let ((,fsym (functionalize ,fun)))
263
+       (lambda (,seq)
264
+         (apply ,fsym ,@args ,seq)))))
263 265
 
264 266
 (defun-ct on (fun key)
265
-  (lambda (it)
266
-    (funcall fun (funcall key it))))
267
+  (let ((fun (functionalize fun))
268
+        (key (functionalize key)))
269
+    (lambda (it)
270
+      (funcall fun (funcall key it)))))
267 271
 
268 272
 (defun filler (length1 length2 fill-value)
269 273
   (if (< length1 length2)