aboutsummaryrefslogtreecommitdiff
path: root/hofs.lisp
diff options
context:
space:
mode:
Diffstat (limited to 'hofs.lisp')
-rw-r--r--hofs.lisp9
1 files changed, 9 insertions, 0 deletions
diff --git a/hofs.lisp b/hofs.lisp
index 7f7afce..e8bdbc4 100644
--- a/hofs.lisp
+++ b/hofs.lisp
@@ -27,3 +27,12 @@ returning a list of return values."
(lambda (&rest args)
(loop :for fn :in (cons fn1 fns)
:collect (apply fn args))))
+
+
+(defun rev (fn)
+ "Return a function that applies its arguments to FN in reverse order.
+
+E.g. (funcall (rev #'cons) 1 2) ;; (2 . 1)"
+ (lambda (&rest args)
+ (apply fn (reverse args))))
+