bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#49316: Add apply-partially's right version


From: daanturo
Subject: bug#49316: Add apply-partially's right version
Date: Fri, 2 Jul 2021 00:06:35 +0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0


--=-=-=
Content-Type: text/plain

Tags:  49316 + patch

Added documentation in doc/lispref/functions.texi and etc/NEWS.

(Please ignore my immediately precededing email, I'm sorry for not being used to sending patches by mailing list.)

Thank you.


--=-=-=
Content-Type: text/patch
Content-Disposition: attachment;
filename=0002-Add-apply-rpartially-documents.patch

From b56a83f2765d3dfb1db011acc561bf107c934594 Mon Sep 17 00:00:00 2001
From: Daanturo <daanturo@gmail.com>
Date: Thu, 1 Jul 2021 23:01:42 +0700
Subject: [PATCH 2/2] Add apply-rpartially documents

* doc/lispref/functions.texi (Calling Functions): Add explanation and
example usage
* etc/NEWS (Lisp Changes in Emacs 28.1): Announce new function
---
doc/lispref/functions.texi | 17 +++++++++++++++++
etc/NEWS | 5 +++++
2 files changed, 22 insertions(+)

diff --git a/doc/lispref/functions.texi b/doc/lispref/functions.texi
index 64883bf0f6..80d0c96687 100644
--- a/doc/lispref/functions.texi
+++ b/doc/lispref/functions.texi
@@ -845,6 +845,23 @@ built-in function:
@end example
@end defun

+@defun apply-rpartially func &rest args
+This function does mostly the same as @code{apply-partially}, but
+@var{args} are aligned to the right of @var{func}'s parameters
+instead.
+
+@example
+@group
+(defalias 'square (apply-rpartially #'expt 2)
+ "Return argument squared.")
+@end group
+@group
+(square 3)
+ @result{} 9
+@end group
+@end example
+@end defun
+
@cindex functionals
It is common for Lisp functions to accept functions as arguments or
find them in data structures (especially in hook variables and property
diff --git a/etc/NEWS b/etc/NEWS
index 605c4d228f..252e6b4d0b 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -2909,6 +2909,11 @@ The former is now declared obsolete.

* Lisp Changes in Emacs 28.1

++++
+** New function 'apply-rpartially'.
+Funcionally equivalent to 'apply-partially' but arguments are aligned
+to the right instead.
+
+++
** New function 'syntax-class-to-char'.
This does almost the opposite of 'string-to-syntax' -- it returns the
--
2.32.0


--=-=-=--

--
Daanturo.

Attachment: 0002-Add-apply-rpartially-documents.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]