>From c594d6fc396b80019c48e63918f8c5e485f2782f Mon Sep 17 00:00:00 2001 From: Daanturo Date: Thu, 1 Jul 2021 19:21:08 +0700 Subject: [PATCH] Define apply-rpatially Which is analogous to `apply-partially` but arguments are aligned on the right instead. --- lisp/subr.el | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lisp/subr.el b/lisp/subr.el index e49c277335..5965655d48 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -465,6 +465,15 @@ was called." (lambda (&rest args2) (apply fun (append args args2)))) +(defun apply-rpartially (fun &rest args) + "Return a function that is a partial application of FUN to ARGS to the right. +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 args1) + (apply fun (append args1 args)))) + (defun zerop (number) "Return t if NUMBER is zero." ;; Used to be in C, but it's pointless since (= 0 n) is faster anyway because -- 2.32.0