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 09:49:19 +0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0


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

Tags: patch


I have replaced the examples:


          (defalias '**2 (apply-rpartially #'expt 2)
            "Return argument ** 2.")
          (defalias '2** (apply-partially #'expt 2)
            "Return 2 ** argument.")
          (**2 3)
               => 9
          (2** 3)
               => 8


--=-=-=
Content-Type: text/patch
Content-Disposition: attachment;
filename=0004-Better-apply-rpartially-documentation.patch

From ab6977b40a4d2be418716c16bb0d38c35e62b62f Mon Sep 17 00:00:00 2001
From: Daanturo <daanturo@gmail.com>
Date: Fri, 2 Jul 2021 09:43:27 +0700
Subject: [PATCH] Better apply-rpartially documentation

* doc/lispref/functions.texi (Calling Functions): provide comparison
with apply-partially
---
doc/lispref/functions.texi | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/doc/lispref/functions.texi b/doc/lispref/functions.texi
index 80d0c96687..9e08affd1e 100644
--- a/doc/lispref/functions.texi
+++ b/doc/lispref/functions.texi
@@ -847,17 +847,21 @@ built-in function:

@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.
+@var{args} are the last arguments to be passed to @var{func}'s
+parameters instead.

@example
@group
-(defalias 'square (apply-rpartially #'expt 2)
- "Return argument squared.")
+(defalias '**2 (apply-rpartially #'expt 2)
+ "Return argument ** 2.")
+(defalias '2** (apply-partially #'expt 2)
+ "Return 2 ** argument.")
@end group
@group
-(square 3)
+(**2 3)
@result{} 9
+(2** 3)
+ @result{} 8
@end group
@end example
@end defun
--
2.32.0


--=-=-=--

On 7/2/21 1:45 AM, Eli Zaretskii wrote:
From: daanturo <daanturo@gmail.com>
Date: Fri, 2 Jul 2021 00:06:35 +0700
Cc: "Basil L. Contovounesios" <contovob@tcd.ie>

(Please ignore my immediately precededing email, I'm sorry for not being
used to sending patches by mailing list.)
I see no problems in the preceding email, so I think you have nothing
to apologize for.

+@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.
I don't think this explains the purpose of the function clearly
enough.  The documentation of apply-partially doesn't mention any
"alignment", so it's hard to understand what you want to say here.
Can you think of a better description?

+@example
+@group
+(defalias 'square (apply-rpartially #'expt 2)
+ "Return argument squared.")
+@end group
+@group
+(square 3)
+ @result{} 9
+@end group
+@end example
IMO, the example could be more revealing if you could contrast
apply-rpartially with apply-partially.

++++
+** New function 'apply-rpartially'.
+Funcionally equivalent to 'apply-partially' but arguments are aligned
+to the right instead.
After we find a good wording for the manual, we should think how to
reword the NEWS entry accordingly.

Thanks.

--
Daanturo.

Attachment: 0004-Better-apply-rpartially-documentation.patch
Description: Text Data


reply via email to

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