aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcolin <colin@cicadas.surf>2023-02-28 20:14:57 -0800
committercolin <colin@cicadas.surf>2023-02-28 20:14:57 -0800
commitb4c1525e4c93e8e277e9484a4ae3669007e86712 (patch)
tree305a1620105568fdf0d09289fb34c5cfcc6549fe
parentbfddf4064215fb5cd22a1d54c7f4616e82256214 (diff)
add mapped
-rw-r--r--hofs.lisp6
-rw-r--r--package.lisp1
2 files changed, 7 insertions, 0 deletions
diff --git a/hofs.lisp b/hofs.lisp
index 71720ec..7f7afce 100644
--- a/hofs.lisp
+++ b/hofs.lisp
@@ -21,3 +21,9 @@ PRED, THEN, and ELSE are assumed to accept the same arguments."
when (apply pred args)
return (apply fn args))))
+(defun mapped (fn1 &rest fns)
+ "Return a function the arguments of which are applied to (FN1 . FNS),
+returning a list of return values."
+ (lambda (&rest args)
+ (loop :for fn :in (cons fn1 fns)
+ :collect (apply fn args))))
diff --git a/package.lisp b/package.lisp
index 2db36f3..45c1374 100644
--- a/package.lisp
+++ b/package.lisp
@@ -3,5 +3,6 @@
(defpackage #:lambda-riffs
(:use #:cl)
(:export #:closure
+ #:mapped
#:lambda-if
#:lambda-cond))