mirror of
https://github.com/fiddlerwoaroof/data-lens.git
synced 2025-11-08 10:16:32 +00:00
feat: add default return value to applicable-when
This commit is contained in:
15
lens.lisp
15
lens.lisp
@ -115,11 +115,16 @@
|
||||
(<= (length it)
|
||||
len)))
|
||||
|
||||
(defun applicable-when (fun test)
|
||||
(lambda (it)
|
||||
(if (funcall test it)
|
||||
(funcall fun it)
|
||||
it)))
|
||||
(defun applicable-when (fun test &optional (default nil default-p))
|
||||
(if default-p
|
||||
(lambda (it)
|
||||
(if (funcall test it)
|
||||
(funcall fun it)
|
||||
default))
|
||||
(lambda (it)
|
||||
(if (funcall test it)
|
||||
(funcall fun it)
|
||||
it))))
|
||||
|
||||
(defmacro conj (&rest fns)
|
||||
(let ((dat (gensym "dat")))
|
||||
|
||||
Reference in New Issue
Block a user