chore: more tests, fixes

- add DELAY
- fix definition of OF-MAX-LENGTH
- add ignorable declaration to CONJ and DISJ
- lots of new tests
This commit is contained in:
Edward Langley
2022-10-01 12:00:23 -07:00
parent 6b83963208
commit 0a90adbe04
4 changed files with 222 additions and 15 deletions

View File

@ -102,7 +102,7 @@
(defun-ct of-max-length (len)
(lambda (it)
(>= (length it)
(<= (length it)
len)))
(defun-ct applicable-when (fun test)
@ -114,6 +114,7 @@
(defmacro conj (&rest fns)
(let ((dat (gensym "dat")))
`(lambda (,dat)
(declare (ignorable ,dat))
(and ,@(mapcar (lambda (fn)
`(funcall ,fn ,dat))
fns)))))
@ -226,6 +227,13 @@
(apply f args))
r)))))
(defun delay ()
"Return a function that always returns the last thing it was called with"
(let ((result nil))
(lambda (v)
(prog1 result
(setf result v)))))
(defun =>> (fun1 fun2)
(lambda (i)
(prog1 (funcall fun1 i)