mirror of
https://github.com/fiddlerwoaroof/data-lens.git
synced 2025-11-08 18:26:32 +00:00
feat(utils): use FUNCTIONALIZE in data-lens. Slightly incompatible
This commit is contained in:
18
lens.lisp
18
lens.lisp
@ -248,8 +248,9 @@
|
|||||||
:initial-value ()))))
|
:initial-value ()))))
|
||||||
|
|
||||||
(defun-ct over (fun &key (result-type 'list))
|
(defun-ct over (fun &key (result-type 'list))
|
||||||
(lambda (seq)
|
(let ((fun (functionalize fun)))
|
||||||
(map result-type fun seq)))
|
(lambda (seq)
|
||||||
|
(map result-type fun seq))))
|
||||||
|
|
||||||
(defun-ct denest (&key (result-type 'list))
|
(defun-ct denest (&key (result-type 'list))
|
||||||
(lambda (seq)
|
(lambda (seq)
|
||||||
@ -257,13 +258,16 @@
|
|||||||
seq)))
|
seq)))
|
||||||
|
|
||||||
(defmacro applying (fun &rest args)
|
(defmacro applying (fun &rest args)
|
||||||
(alexandria:with-gensyms (seq)
|
(alexandria:with-gensyms (seq fsym)
|
||||||
`(lambda (,seq)
|
`(let ((,fsym (functionalize ,fun)))
|
||||||
(apply ,fun ,@args ,seq))))
|
(lambda (,seq)
|
||||||
|
(apply ,fsym ,@args ,seq)))))
|
||||||
|
|
||||||
(defun-ct on (fun key)
|
(defun-ct on (fun key)
|
||||||
(lambda (it)
|
(let ((fun (functionalize fun))
|
||||||
(funcall fun (funcall key it))))
|
(key (functionalize key)))
|
||||||
|
(lambda (it)
|
||||||
|
(funcall fun (funcall key it)))))
|
||||||
|
|
||||||
(defun filler (length1 length2 fill-value)
|
(defun filler (length1 length2 fill-value)
|
||||||
(if (< length1 length2)
|
(if (< length1 length2)
|
||||||
|
|||||||
Reference in New Issue
Block a user