unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: daanturo <daanturo@gmail.com>
To: 49316@debbugs.gnu.org
Cc: contovob@tcd.ie
Subject: bug#49316: Add apply-partially's right version
Date: Fri, 2 Jul 2021 09:49:19 +0700	[thread overview]
Message-ID: <27c5c6c9-32d7-0b9a-b883-4f28167ec25c@gmail.com> (raw)
In-Reply-To: <834kddlvpg.fsf@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 3210 bytes --]


--=-=-=
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 #2: 0004-Better-apply-rpartially-documentation.patch --]
[-- Type: text/x-patch, Size: 1250 bytes --]

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


  reply	other threads:[~2021-07-02  2:49 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-01 12:40 bug#49316: Add apply-partially's right version daanturo
2021-07-01 13:11 ` Basil L. Contovounesios
2021-07-01 16:24   ` daanturo
2021-07-01 17:06     ` daanturo
2021-07-01 17:16       ` daanturo
2021-07-01 18:45       ` Eli Zaretskii
2021-07-02  2:49         ` daanturo [this message]
2021-07-03  7:03           ` Eli Zaretskii
2021-10-24  6:55             ` Stefan Kangas
2021-10-24 10:49               ` daanturo
2021-10-24 11:18                 ` Stefan Kangas
2021-10-24 12:13                   ` Eli Zaretskii
2021-10-24 13:47                     ` Lars Ingebrigtsen
2021-10-24 14:10                       ` Stefan Kangas
2021-10-24 14:28                       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-10-25 12:50                         ` Lars Ingebrigtsen
2021-10-24 13:38               ` Lars Ingebrigtsen
2021-07-02 16:32         ` daanturo
2021-07-03  7:03           ` Eli Zaretskii
2021-07-01 22:34 ` Michael Heerdegen
2021-07-02  4:39   ` daanturo
2021-07-03  3:06     ` Michael Heerdegen
2021-07-03  6:17       ` daanturo
2021-07-03 14:13       ` Phil Sainty
2021-07-05  4:29         ` daanturo
2021-07-05 12:02           ` Phil Sainty
2021-07-06  4:33           ` Michael Heerdegen
2021-07-07 16:30             ` daanturo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=27c5c6c9-32d7-0b9a-b883-4f28167ec25c@gmail.com \
    --to=daanturo@gmail.com \
    --cc=49316@debbugs.gnu.org \
    --cc=contovob@tcd.ie \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).