From 3404899ec390fac7886871f293eac9d454ec7c06 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Sun, 21 Jul 2019 19:13:21 +0200 Subject: [PATCH] core-lib: add doom-partial & doom-rpartial functions --- core/core-lib.el | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/core/core-lib.el b/core/core-lib.el index 2325b4f57..5bbb7e5f3 100644 --- a/core/core-lib.el +++ b/core/core-lib.el @@ -177,6 +177,17 @@ Accepts the same arguments as `message'." format-string) ,@args)))) +(defalias 'doom-partial #'apply-partially) + +(defun doom-rpartial (fn &rest args) + "Return a function that is a partial application of FUN to right-hand ARGS. + +ARGS is a list of the last N arguments to pass to FUN. The result is a new +function which does the same as FUN, except that the last N arguments are fixed +at the values with which this function was called." + (lambda (&rest pre-args) + (apply fn (append pre-args args)))) + (cl-defun doom-files-in (paths &rest rest &key