aboutsummaryrefslogtreecommitdiff
path: root/functions.lisp
diff options
context:
space:
mode:
authorColin Okay <okay@toyful.space>2020-12-13 07:27:53 -0600
committerColin Okay <okay@toyful.space>2020-12-13 07:27:53 -0600
commitd25e5a1cdd2e934c8c21851aac93d9a30b8bb0cf (patch)
treeffc7130db2c7fe75cb765da5f47fb1c83924dfb8 /functions.lisp
parent2e2263a011846cb04dce9538079d2d5e9b7724d0 (diff)
renaming
Diffstat (limited to 'functions.lisp')
-rw-r--r--functions.lisp28
1 files changed, 28 insertions, 0 deletions
diff --git a/functions.lisp b/functions.lisp
new file mode 100644
index 0000000..3c06f79
--- /dev/null
+++ b/functions.lisp
@@ -0,0 +1,28 @@
+;;;; lambda-tools.lisp
+
+(in-package #:lambda-riffs)
+
+(defun -> (arg &rest fns)
+ (dolist (fn fns arg)
+ (setf arg (funcall fn arg))))
+
+(defun all> (arg &rest preds)
+ "Predicate Filter. Returns ARG if (PRED ARG) is non-NIL for each
+PRED in PREDS"
+ (dolist (pred preds arg)
+ (unless (funcall pred arg)
+ (return-from all> nil))))
+
+
+(defun some> (arg &rest preds)
+ (dolist (pred preds nil)
+ (when (funcall pred arg)
+ (return-from some> arg))))
+
+
+(defun <> (&rest fns)
+ (lambda (arg)
+ (apply #'>> arg fns)))
+
+
+