GNU bug report logs - #49316
Add apply-partially's right version

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: daanturo <daanturo@HIDDEN>; Keywords: patch; dated Thu, 1 Jul 2021 12:41:02 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 49316 <at> debbugs.gnu.org:


Received: (at 49316) by debbugs.gnu.org; 2 Jul 2021 16:32:37 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Jul 02 12:32:36 2021
Received: from localhost ([127.0.0.1]:36991 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1lzM5k-0007Ha-Is
	for submit <at> debbugs.gnu.org; Fri, 02 Jul 2021 12:32:36 -0400
Received: from mail-pf1-f175.google.com ([209.85.210.175]:34549)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <daanturo@HIDDEN>) id 1lzM5i-0007HM-I2
 for 49316 <at> debbugs.gnu.org; Fri, 02 Jul 2021 12:32:35 -0400
Received: by mail-pf1-f175.google.com with SMTP id f20so1477983pfa.1
 for <49316 <at> debbugs.gnu.org>; Fri, 02 Jul 2021 09:32:34 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=subject:to:cc:references:from:message-id:date:user-agent
 :mime-version:in-reply-to:content-language;
 bh=8CkrC9+Z1vdLcPhZIBhEFS6eJRvHaytg9Er88Aszegw=;
 b=I+Ui5GghMneUXuhSyzt+8nHMVRjgtgge4rW+U0DB89xINYHGKczv9H1pEA9n2H8Xnn
 A7iDtVAIB47uYqmuOMfmqey4XvIjuIImJ88skF4K462EALuT9L9mcy/yg7bGTtOxX5cj
 g5CsZc4d9A/O7KP/OQlvxIsvUMBaYJxK0s7h2fJ3tr1Cs0NKcm+gXv6D+7hmzkRYz0iw
 7x/k64ZfjK+rxT+tnLGxygxpHk6juzj0+2CGLfEGXI3tQW0iNbOat3WSsjiNpOiY+uNP
 7OYt9OLm/WoOvcKr12F04jxc4opvBlKSiYZJpVuBG/NkttPhJociLhU4ose7NUHoXPGw
 AqBw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:subject:to:cc:references:from:message-id:date
 :user-agent:mime-version:in-reply-to:content-language;
 bh=8CkrC9+Z1vdLcPhZIBhEFS6eJRvHaytg9Er88Aszegw=;
 b=Xi0Prl2RZRFuEHqMKVCiuPY7gPTgXcNEOerdxIYgRzFaqqVHBAQsidmyrJPpQ5Jnwd
 7iyt+5AsvffjECU9RAU0RWaMB2sJNERjS0rSCJ7rBpESSTou3D1LWexCfIeuQtD7DDTj
 fuL5AOB+mR0F1QDDFpWQECOC+cZ1oaeLm1sZkScyzReN4S0JZ+xTi/JGknjMceC0B1w7
 WnE1qvD0d9BW++MLsbDTJLk8KlH1heGc6G9EYFBhXO/4SjAyRj2J5dCJ2Hvwh8BJxDmv
 eUwdWuuSxjJiFCx+ELVHIeSdi8PIKEtRBna5XkyFS6f8XaUpKDStkdkhJm5lrPYRmjVf
 fvOQ==
X-Gm-Message-State: AOAM531KEjmigbtgOmdzK9ovurV6Dir9YXLkIYGH6gKhSkwhrMRHryBx
 Df46u5DXmcFRU5BpA3SiRXT2bNtdtRiC7Q==
X-Google-Smtp-Source: ABdhPJzhSQyOqnd6+zB7HmwY78Mfsn+cvtah8bzqQheNCLc7Z2TNMFDDAoCH/pIYOVRVlsYUSc/XOw==
X-Received: by 2002:a63:f65:: with SMTP id 37mr786428pgp.367.1625243548618;
 Fri, 02 Jul 2021 09:32:28 -0700 (PDT)
Received: from ?IPv6:2402:800:630f:53b:ee3a:5256:1634:1e03?
 ([2402:800:630f:53b:ee3a:5256:1634:1e03])
 by smtp.gmail.com with ESMTPSA id 20sm3981441pfi.170.2021.07.02.09.32.26
 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
 Fri, 02 Jul 2021 09:32:28 -0700 (PDT)
Subject: Re: bug#49316: Add apply-partially's right version
To: 49316 <at> debbugs.gnu.org
References: <2315db79-00cf-b2f0-b5df-93cd53392292@HIDDEN>
 <87czs2faas.fsf@HIDDEN> <daeadd8a-dc11-af17-c543-f7545e81b73b@HIDDEN>
 <e780b390-eac8-e50e-afc5-72556349bf79@HIDDEN> <834kddlvpg.fsf@HIDDEN>
From: daanturo <daanturo@HIDDEN>
Message-ID: <67d42829-b223-198b-3d46-c2705a7bbfc2@HIDDEN>
Date: Fri, 2 Jul 2021 23:32:25 +0700
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101
 Thunderbird/78.11.0
MIME-Version: 1.0
In-Reply-To: <834kddlvpg.fsf@HIDDEN>
Content-Type: multipart/mixed; boundary="------------BA23B12AC3991520B2AB21BF"
Content-Language: en-US
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 49316
Cc: Eli Zaretskii <eliz@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

This is a multi-part message in MIME format.
--------------BA23B12AC3991520B2AB21BF
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit


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

Tags: patch


Re-write the NEWS entry of apply-rpartially.




--=-=-=
Content-Type: text/patch
Content-Disposition: attachment;
filename=0005-Better-explanation-for-apply-rpartially-in-NEWS.patch

 From 339b0ed82dbc0430ce71294f04a53547f532c1af Mon Sep 17 00:00:00 2001
From: Daanturo <daanturo@HIDDEN>
Date: Fri, 2 Jul 2021 23:24:37 +0700
Subject: [PATCH] Better explanation for apply-rpartially in NEWS

* etc/NEWS (Lisp Changes in Emacs 28.1): Better explanation for
apply-rpartially
---
etc/NEWS | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/etc/NEWS b/etc/NEWS
index be30d6c859..a06456035c 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -2911,8 +2911,8 @@ The former is now declared obsolete.

+++
** New function 'apply-rpartially'.
-Functionally equivalent to 'apply-partially' but arguments are aligned
-to the right instead.
+This is almost similar to 'apply-partially' except that the last
+arguments are fixed instead of first ones.

+++
** New function 'syntax-class-to-char'.
-- 
2.32.0


--=-=-=--

On 7/2/21 1:45 AM, Eli Zaretskii wrote:
>> From: daanturo <daanturo@HIDDEN>
>> Date: Fri, 2 Jul 2021 00:06:35 +0700
>> Cc: "Basil L. Contovounesios" <contovob@HIDDEN>
>>
>> (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.


--------------BA23B12AC3991520B2AB21BF
Content-Type: text/x-patch; charset=UTF-8;
 name="0005-Better-explanation-for-apply-rpartially-in-NEWS.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename*0="0005-Better-explanation-for-apply-rpartially-in-NEWS.patch"

From 339b0ed82dbc0430ce71294f04a53547f532c1af Mon Sep 17 00:00:00 2001
From: Daanturo <daanturo@HIDDEN>
Date: Fri, 2 Jul 2021 23:24:37 +0700
Subject: [PATCH] Better explanation for apply-rpartially in NEWS

* etc/NEWS (Lisp Changes in Emacs 28.1): Better explanation for
apply-rpartially
---
 etc/NEWS | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/etc/NEWS b/etc/NEWS
index be30d6c859..a06456035c 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -2911,8 +2911,8 @@ The former is now declared obsolete.
 
 +++
 ** New function 'apply-rpartially'.
-Functionally equivalent to 'apply-partially' but arguments are aligned
-to the right instead.
+This is almost similar to 'apply-partially' except that the last
+arguments are fixed instead of first ones.
 
 +++
 ** New function 'syntax-class-to-char'.
-- 
2.32.0


--------------BA23B12AC3991520B2AB21BF--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#49316; Package emacs. Full text available.

Message received at 49316 <at> debbugs.gnu.org:


Received: (at 49316) by debbugs.gnu.org; 2 Jul 2021 04:39:14 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Jul 02 00:39:14 2021
Received: from localhost ([127.0.0.1]:33935 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1lzAxO-00088u-4T
	for submit <at> debbugs.gnu.org; Fri, 02 Jul 2021 00:39:14 -0400
Received: from mail-pl1-f172.google.com ([209.85.214.172]:43741)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <daanturo@HIDDEN>) id 1lzAxL-00088g-Uy
 for 49316 <at> debbugs.gnu.org; Fri, 02 Jul 2021 00:39:13 -0400
Received: by mail-pl1-f172.google.com with SMTP id i13so4908969plb.10
 for <49316 <at> debbugs.gnu.org>; Thu, 01 Jul 2021 21:39:11 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=subject:to:cc:references:from:message-id:date:user-agent
 :mime-version:in-reply-to:content-language;
 bh=ZGd8Ci5HdaW6v/TMxm7h6uSvzP4EAwplyTjBox/fuNo=;
 b=PoUpX0xwbUBnNfo7XU9gfHEq11NDSaXI3t7Ztp+oHN9VPMG+K1UEr/EkIq27M9tdfn
 GdEt0JW6XNnN8UrjguklRvFMX/9Td2t07xtAWCzDSE4wg0HE8yzTiYQmadUOBPUg8AWi
 gwL7Yl4weiEgNYL6uAuPzDf3KyaYRFy3yhfoHcmkl3GtgiDEZfnSMPPZb+bYu4v/Oz0Y
 MxQhPkdiQoTV14we8MOmhU7abv3qEmOcX2jdVdU4AjbGBAdWRZvjPFitWWTmb4mcwQwM
 Vcl8R/6vOfeNRCLOfe9DrY5l89G3yt58U80j9/QD1bo7OfQTd5e5q4/P20S3mj4A+vEd
 9acw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:subject:to:cc:references:from:message-id:date
 :user-agent:mime-version:in-reply-to:content-language;
 bh=ZGd8Ci5HdaW6v/TMxm7h6uSvzP4EAwplyTjBox/fuNo=;
 b=ekZwUoXmwH0HTxamjmfC9P37yIg0bL4Xvc4f3220+ZKAA3MRLurdLv13bQeAySEONP
 px80+7jKMxRrI9JDViSbZRkzg+JbZnjq4nP0ZITLyNa3wervo3ByaTNz5xCIJ/p4Zb9Z
 5EbBLp85g+SZhiR/7QahFdA2TgZaqmAhL/xb/X8K8uitHuOE9+8vg/+wOZCP2PVbdcUh
 TYcp991grS2kuCwISXWd/bsGeUNO7pc1GRhhrgCscZ7cFoV8pZZZVQBpAMJWQngjfMuA
 IbXRtjJS7/f5S02bdPkOh9+MlYFNWb9JwsKLpdeIA2rJa9ntYT0jMxsuwDbmJMwiAESy
 /LWg==
X-Gm-Message-State: AOAM531m3S56Ct6zCXW9ZAMt971IzOlvUfGD1tVP6dpjkRg+buFgWnNZ
 ObcpARv0JUSbFDMuPo5d0Nw=
X-Google-Smtp-Source: ABdhPJxAbf45kMV9QB+xry0IRCE640+zQlPTKZmO5lYfbqvM+lEFIpoukm2VdWB6IjIXaxa0ZhzLag==
X-Received: by 2002:a17:90b:4ac8:: with SMTP id
 mh8mr3075811pjb.84.1625200746093; 
 Thu, 01 Jul 2021 21:39:06 -0700 (PDT)
Received: from ?IPv6:2402:800:630f:53b:ee3a:5256:1634:1e03?
 ([2402:800:630f:53b:ee3a:5256:1634:1e03])
 by smtp.gmail.com with ESMTPSA id d127sm1668960pfc.50.2021.07.01.21.39.04
 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
 Thu, 01 Jul 2021 21:39:05 -0700 (PDT)
Subject: Re: bug#49316: Add apply-partially's right version
To: 49316 <at> debbugs.gnu.org
References: <2315db79-00cf-b2f0-b5df-93cd53392292@HIDDEN>
 <87r1ghr7d1.fsf@HIDDEN>
From: daanturo <daanturo@HIDDEN>
Message-ID: <5a08f089-3a19-d747-5098-4751c92a5b79@HIDDEN>
Date: Fri, 2 Jul 2021 11:39:03 +0700
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101
 Thunderbird/78.11.0
MIME-Version: 1.0
In-Reply-To: <87r1ghr7d1.fsf@HIDDEN>
Content-Type: multipart/mixed; boundary="------------88E6D1A450B33722F674C365"
Content-Language: en-US
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 49316
Cc: Michael Heerdegen <michael_heerdegen@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

This is a multi-part message in MIME format.
--------------88E6D1A450B33722F674C365
Content-Type: multipart/alternative;
 boundary="------------10EC503E83421FDEA3A2A9BB"


--------------10EC503E83421FDEA3A2A9BB
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit


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

Tags: patch


 > Could we instead
 > provide something that allows partial application of arbitrary
 > arguments, e.g. one of the arguments in the middle?

I have tried implementing, but it's really hard to provide a practical
example for documenting.

Also, most of the time after specifying a position, we would insert to
left of that. If 0 is for regular `apply-partially`, then -1 is
certainly not possible for `apply-rpartially`.

To pass ARGS at the last, should the following condition be OK?:

"If POSITION is not an integer or is >= the length of the function
application's arguments in the future."

(funcall (apply-mid-partially #'append 0 '(0 1 2 3)) '(4) '(5)) ; 
Equivalent to `apply-partially'`
=> (0 1 2 3 4 5)

(funcall (apply-mid-partially #'append 1 '(1 2 3)) '(0) '(4))
=> (0 1 2 3 4)

(funcall (apply-mid-partially #'append -1 '(1 2 3)) '(-2 -1) '(4 5) '(6 7))
=> (-2 -1 4 5 1 2 3 6 7)

; apply-rpartially
(funcall (apply-mid-partially #'append most-positive-fixnum '(1 2 3)) 
'(-2 -1) '(4 5) '(6 7))
=> (-2 -1 4 5 6 7 1 2 3)

(funcall (apply-mid-partially #'append 'foo '(1 2 3)) '(-2 -1) '(4 5) 
'(6 7))
=> (-2 -1 4 5 6 7 1 2 3)


--=-=-=
Content-Type: text/patch
Content-Disposition: attachment;
filename=0005-b-Define-apply-mid-partially.patch

 From 88522f33b497a6463ee73c4ba9479e853291035a Mon Sep 17 00:00:00 2001
From: Daanturo <daanturo@HIDDEN>
Date: Fri, 2 Jul 2021 11:22:11 +0700
Subject: [PATCH] Define apply-mid-partially

* lisp/subr.el (apply-mid-partially): Currying functions with arbitrary
arguments position.
---
lisp/subr.el | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)

diff --git a/lisp/subr.el b/lisp/subr.el
index 5965655d48..2c25343a76 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -474,6 +474,33 @@ function was called."
(lambda (&rest args1)
(apply fun (append args1 args))))

+(defun apply-mid-partially (fun position &rest args)
+ "Return a function that is a partial application of FUN to ARGS at 
POSITION.
+
+ARGS is a list of N arguments to pass to FUN, starting at
+POSITION (integer).
+
+The result is a new function which does the same as FUN, except
+that N arguments starting from POSITION (inclusive) are fixed at the
+values with which this function was called.
+
+If POSITION is not an integer or is >= the length of the function
+application's arguments in the future, ARGS will be at the last.
+
+Else if POSITION is non-negative integer, count from the left.
+
+Else (POSITION is a negative integer), count from the right."
+ (lambda (&rest other-args)
+ (let* ((right-partially (or (not (integerp position))
+ (<= (length other-args) position)))
+ (first-args (seq-subseq other-args
+ 0
+ (if right-partially nil position)))
+ (last-args (if right-partially
+ nil
+ (seq-subseq other-args position))))
+ (apply fun (append first-args args last-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


--=-=-=--



On 7/2/21 5:34 AM, Michael Heerdegen wrote:
> daanturo <daanturo@HIDDEN> writes:
>
> | +(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.
>
> I wonder: If we leave syntax aside for a moment - this suggestion seems
> to provide a solution for a quite special case: is this useful more
> often than partial application of arbitrary arguments?  Could we instead
> provide something that allows partial application of arbitrary
> arguments, e.g. one of the arguments in the middle?
>
>
> Michael.

-- 
Daanturo.


--------------10EC503E83421FDEA3A2A9BB
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: 7bit

<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <font face="monospace"><br>
      --=-=-=
      <br>
      Content-Type: text/plain
      <br>
      <br>
      Tags: patch
      <br>
      <br>
      <br>
      &gt; Could we instead
      <br>
      &gt; provide something that allows partial application of
      arbitrary
      <br>
      &gt; arguments, e.g. one of the arguments in the middle?
      <br>
      <br>
      I have tried implementing, but it's really hard to provide a
      practical
      <br>
      example for documenting.
      <br>
      <br>
      Also, most of the time after specifying a position, we would
      insert to
      <br>
      left of that. If 0 is for regular `apply-partially`, then -1 is
      <br>
      certainly not possible for `apply-rpartially`.
      <br>
      <br>
      To pass ARGS at the last, should the following condition be OK?:
      <br>
      <br>
      "If POSITION is not an integer or is &gt;= the length of the
      function
      <br>
      application's arguments in the future."
      <br>
      <br>
      (funcall (apply-mid-partially #'append 0 '(0 1 2 3)) '(4) '(5)) ;
      Equivalent to `apply-partially'`
      <br>
      =&gt; (0 1 2 3 4 5)
      <br>
      <br>
      (funcall (apply-mid-partially #'append 1 '(1 2 3)) '(0) '(4))
      <br>
      =&gt; (0 1 2 3 4)
      <br>
      <br>
      (funcall (apply-mid-partially #'append -1 '(1 2 3)) '(-2 -1) '(4
      5) '(6 7))
      <br>
      =&gt; (-2 -1 4 5 1 2 3 6 7)
      <br>
      <br>
      ; apply-rpartially
      <br>
      (funcall (apply-mid-partially #'append most-positive-fixnum '(1 2
      3)) '(-2 -1) '(4 5) '(6 7))
      <br>
      =&gt; (-2 -1 4 5 6 7 1 2 3)
      <br>
      <br>
      (funcall (apply-mid-partially #'append 'foo '(1 2 3)) '(-2 -1) '(4
      5) '(6 7))
      <br>
      =&gt; (-2 -1 4 5 6 7 1 2 3)
      <br>
      <br>
      <br>
      --=-=-=
      <br>
      Content-Type: text/patch
      <br>
      Content-Disposition: attachment;
      <br>
      filename=0005-b-Define-apply-mid-partially.patch
      <br>
      <br>
      From 88522f33b497a6463ee73c4ba9479e853291035a Mon Sep 17 00:00:00
      2001
      <br>
      From: Daanturo <a class="moz-txt-link-rfc2396E" href="mailto:daanturo@HIDDEN">&lt;daanturo@HIDDEN&gt;</a>
      <br>
      Date: Fri, 2 Jul 2021 11:22:11 +0700
      <br>
      Subject: [PATCH] Define apply-mid-partially
      <br>
      <br>
      * lisp/subr.el (apply-mid-partially): Currying functions with
      arbitrary
      <br>
      arguments position.
      <br>
      ---
      <br>
      lisp/subr.el | 27 +++++++++++++++++++++++++++
      <br>
      1 file changed, 27 insertions(+)
      <br>
      <br>
      diff --git a/lisp/subr.el b/lisp/subr.el
      <br>
      index 5965655d48..2c25343a76 100644
      <br>
      --- a/lisp/subr.el
      <br>
      +++ b/lisp/subr.el
      <br>
      @@ -474,6 +474,33 @@ function was called."
      <br>
      (lambda (&amp;rest args1)
      <br>
      (apply fun (append args1 args))))
      <br>
      <br>
      +(defun apply-mid-partially (fun position &amp;rest args)
      <br>
      + "Return a function that is a partial application of FUN to ARGS
      at POSITION.
      <br>
      +
      <br>
      +ARGS is a list of N arguments to pass to FUN, starting at
      <br>
      +POSITION (integer).
      <br>
      +
      <br>
      +The result is a new function which does the same as FUN, except
      <br>
      +that N arguments starting from POSITION (inclusive) are fixed at
      the
      <br>
      +values with which this function was called.
      <br>
      +
      <br>
      +If POSITION is not an integer or is &gt;= the length of the
      function
      <br>
      +application's arguments in the future, ARGS will be at the last.
      <br>
      +
      <br>
      +Else if POSITION is non-negative integer, count from the left.
      <br>
      +
      <br>
      +Else (POSITION is a negative integer), count from the right."
      <br>
      + (lambda (&amp;rest other-args)
      <br>
      + (let* ((right-partially (or (not (integerp position))
      <br>
      + (&lt;= (length other-args) position)))
      <br>
      + (first-args (seq-subseq other-args
      <br>
      + 0
      <br>
      + (if right-partially nil position)))
      <br>
      + (last-args (if right-partially
      <br>
      + nil
      <br>
      + (seq-subseq other-args position))))
      <br>
      + (apply fun (append first-args args last-args)))))
      <br>
      +
      <br>
      (defun zerop (number)
      <br>
      "Return t if NUMBER is zero."
      <br>
      ;; Used to be in C, but it's pointless since (= 0 n) is faster
      anyway because
      <br>
      -- <br>
      2.32.0
      <br>
      <br>
      <br>
      --=-=-=--
      <br>
      <br>
      <br>
    </font>
    <blockquote>
      <p><font face="monospace"><br>
        </font></p>
    </blockquote>
    <div class="moz-cite-prefix"><font face="monospace">On 7/2/21 5:34
        AM, Michael Heerdegen wrote:<br>
      </font></div>
    <blockquote type="cite" cite="mid:87r1ghr7d1.fsf@HIDDEN">
      <pre class="moz-quote-pre" wrap="">daanturo <a class="moz-txt-link-rfc2396E" href="mailto:daanturo@HIDDEN">&lt;daanturo@HIDDEN&gt;</a> writes:

| +(defun apply-rpartially (fun &amp;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.

I wonder: If we leave syntax aside for a moment - this suggestion seems
to provide a solution for a quite special case: is this useful more
often than partial application of arbitrary arguments?  Could we instead
provide something that allows partial application of arbitrary
arguments, e.g. one of the arguments in the middle?


Michael.
</pre>
    </blockquote>
    <pre class="moz-signature" cols="72">-- 
Daanturo.</pre>
  </body>
</html>

--------------10EC503E83421FDEA3A2A9BB--

--------------88E6D1A450B33722F674C365
Content-Type: text/x-patch; charset=UTF-8;
 name="0005-b-Define-apply-mid-partially.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="0005-b-Define-apply-mid-partially.patch"

From 88522f33b497a6463ee73c4ba9479e853291035a Mon Sep 17 00:00:00 2001
From: Daanturo <daanturo@HIDDEN>
Date: Fri, 2 Jul 2021 11:22:11 +0700
Subject: [PATCH] Define apply-mid-partially

* lisp/subr.el (apply-mid-partially): Currying functions with arbitrary
arguments position.
---
 lisp/subr.el | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/lisp/subr.el b/lisp/subr.el
index 5965655d48..2c25343a76 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -474,6 +474,33 @@ function was called."
   (lambda (&rest args1)
     (apply fun (append args1 args))))
 
+(defun apply-mid-partially (fun position &rest args)
+  "Return a function that is a partial application of FUN to ARGS at POSITION.
+
+ARGS is a list of N arguments to pass to FUN, starting at
+POSITION (integer).
+
+The result is a new function which does the same as FUN, except
+that N arguments starting from POSITION (inclusive) are fixed at the
+values with which this function was called.
+
+If POSITION is not an integer or is >= the length of the function
+application's arguments in the future, ARGS will be at the last.
+
+Else if POSITION is non-negative integer, count from the left.
+
+Else (POSITION is a negative integer), count from the right."
+  (lambda (&rest other-args)
+    (let* ((right-partially (or (not (integerp position))
+                                (<= (length other-args) position)))
+           (first-args (seq-subseq other-args
+                                   0
+                                   (if right-partially nil position)))
+           (last-args (if right-partially
+                          nil
+                        (seq-subseq other-args position))))
+      (apply fun (append first-args args last-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


--------------88E6D1A450B33722F674C365--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#49316; Package emacs. Full text available.

Message received at 49316 <at> debbugs.gnu.org:


Received: (at 49316) by debbugs.gnu.org; 2 Jul 2021 02:49:42 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jul 01 22:49:42 2021
Received: from localhost ([127.0.0.1]:33898 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1lz9FN-0005eg-KS
	for submit <at> debbugs.gnu.org; Thu, 01 Jul 2021 22:49:42 -0400
Received: from mail-pj1-f46.google.com ([209.85.216.46]:51185)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <daanturo@HIDDEN>) id 1lz9FL-0005eM-A0
 for 49316 <at> debbugs.gnu.org; Thu, 01 Jul 2021 22:49:39 -0400
Received: by mail-pj1-f46.google.com with SMTP id ie21so3813923pjb.0
 for <49316 <at> debbugs.gnu.org>; Thu, 01 Jul 2021 19:49:39 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=subject:to:cc:references:from:message-id:date:user-agent
 :mime-version:in-reply-to:content-language;
 bh=fuhwwydK1nYOHcOVpG0n7NKRFQFuu7xVC3Mtc6TfQxM=;
 b=H4psCMHtA+NTzGg2LakxEOAecqsUivsSOcjR4rTyURwVh8CeSJnJXCRA6p+aqQ2wd7
 DEhe3vwLLGxg/ja1pAk4YYQ4oyTpDZ4g6xj0AcblLV4h/SCvOaJj89R2obYoRbqaNuVG
 oaExC7SwQ8qn6mfkJE2i01Dv3Fwark8PoOotkyvqWShHb4+Z8aemykoQZV+AcfyMSb3V
 PAQP7ZUtaGoDUjoGILsIcbjq5krdiMzzokCAsW3GhHDYGnHX+/J4+d9DPah4NlMPKoaX
 +NteAtA194xSXwwfFKhT1BbsKaa6qwnXacPi3KlAUqCNdYekqKZF2FxClc/3bdZ8TWor
 axZQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:subject:to:cc:references:from:message-id:date
 :user-agent:mime-version:in-reply-to:content-language;
 bh=fuhwwydK1nYOHcOVpG0n7NKRFQFuu7xVC3Mtc6TfQxM=;
 b=U16+zwraOTcdsAkn184n983YOGNWv5sewpQdPbUoPeeSzanQHP4ENZbgwHScdVQlWL
 a1GDv6N8WK0jWA1UDL+lAT6Wt2fYw4amYrQMmapXmhm7Ymd9262QUc5LE/gmCAqpckPW
 P+pDg8rS5jowf80mPbwuXz3pYSNNhXioUL9fggOnro6DQc/OwA7xLcQCHLRPDziaOyBj
 P0qhwsyt3GMBLI1yy/TnHqDkPGQeKgX/Mpe028vzx9ROQS5+K0YPKdXBY/WAE202x16Q
 MoMvXT4Cba1snanzuEdOqzKcV/9KJ8K4KPO/12mMcApulPPl7IYbYCzk+u9bX4jRskt7
 DPGg==
X-Gm-Message-State: AOAM532BYwUBm4pLBVuK9lOEBZBE8TyedsrZA8xRxvZ8/aKKQByu1xU1
 AJV8P26psbxe9ata1AmYjUs=
X-Google-Smtp-Source: ABdhPJzJ0TLqBarbN0wJFJVj4moMJ2QEHbOe/jbIGp4LbrwdD4Jr/6l1mwLOntlxcnqQWqZ0f4diYA==
X-Received: by 2002:a17:90a:43c3:: with SMTP id
 r61mr2662769pjg.1.1625194173407; 
 Thu, 01 Jul 2021 19:49:33 -0700 (PDT)
Received: from ?IPv6:2402:800:630f:53b:ee3a:5256:1634:1e03?
 ([2402:800:630f:53b:ee3a:5256:1634:1e03])
 by smtp.gmail.com with ESMTPSA id c9sm1437759pfb.82.2021.07.01.19.49.31
 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
 Thu, 01 Jul 2021 19:49:32 -0700 (PDT)
Subject: Re: bug#49316: Add apply-partially's right version
To: 49316 <at> debbugs.gnu.org
References: <2315db79-00cf-b2f0-b5df-93cd53392292@HIDDEN>
 <87czs2faas.fsf@HIDDEN> <daeadd8a-dc11-af17-c543-f7545e81b73b@HIDDEN>
 <e780b390-eac8-e50e-afc5-72556349bf79@HIDDEN> <834kddlvpg.fsf@HIDDEN>
From: daanturo <daanturo@HIDDEN>
Message-ID: <27c5c6c9-32d7-0b9a-b883-4f28167ec25c@HIDDEN>
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
MIME-Version: 1.0
In-Reply-To: <834kddlvpg.fsf@HIDDEN>
Content-Type: multipart/mixed; boundary="------------BB301AE7B914055C3B749020"
Content-Language: en-US
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 49316
Cc: contovob@HIDDEN, Eli Zaretskii <eliz@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

This is a multi-part message in MIME format.
--------------BB301AE7B914055C3B749020
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit


--=-=-=
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@HIDDEN>
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@HIDDEN>
>> Date: Fri, 2 Jul 2021 00:06:35 +0700
>> Cc: "Basil L. Contovounesios" <contovob@HIDDEN>
>>
>> (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.


--------------BB301AE7B914055C3B749020
Content-Type: text/x-patch; charset=UTF-8;
 name="0004-Better-apply-rpartially-documentation.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="0004-Better-apply-rpartially-documentation.patch"

From ab6977b40a4d2be418716c16bb0d38c35e62b62f Mon Sep 17 00:00:00 2001
From: Daanturo <daanturo@HIDDEN>
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


--------------BB301AE7B914055C3B749020--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#49316; Package emacs. Full text available.

Message received at 49316 <at> debbugs.gnu.org:


Received: (at 49316) by debbugs.gnu.org; 1 Jul 2021 22:34:44 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jul 01 18:34:44 2021
Received: from localhost ([127.0.0.1]:33800 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1lz5Ge-0007qB-G1
	for submit <at> debbugs.gnu.org; Thu, 01 Jul 2021 18:34:44 -0400
Received: from mout.web.de ([212.227.15.3]:57117)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <michael_heerdegen@HIDDEN>) id 1lz5Gc-0007px-HG
 for 49316 <at> debbugs.gnu.org; Thu, 01 Jul 2021 18:34:43 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de;
 s=dbaedf251592; t=1625178875;
 bh=kfhfe10mkcjd0NCQFh5BE/oenN64L+lieZYo5lq9dEg=;
 h=X-UI-Sender-Class:From:To:Cc:Subject:References:Date:In-Reply-To;
 b=coHBWcfg7gSp1VtLBxs6VQkhGgLjasWgnB28u/p8MWd3qy02+tSIXM1/VkmVAzpSZ
 F9+LhHPB2z0hwKr/dzemrkQy/mfJmTp/T0Z/oILHj35OZumsmynIsVhY5ZqLm9H4XW
 luCdLFMfCc1N2R1kZNZU/7a5NaTTiaYH+2Vp2cdY=
X-UI-Sender-Class: c548c8c5-30a9-4db5-a2e7-cb6cb037b8f9
Received: from drachen.dragon ([178.6.28.156]) by smtp.web.de (mrweb002
 [213.165.67.108]) with ESMTPSA (Nemesis) id 0MVcrf-1liIuy31ZP-00Z265; Fri, 02
 Jul 2021 00:34:35 +0200
From: Michael Heerdegen <michael_heerdegen@HIDDEN>
To: daanturo <daanturo@HIDDEN>
Subject: Re: bug#49316: Add apply-partially's right version
References: <2315db79-00cf-b2f0-b5df-93cd53392292@HIDDEN>
Date: Fri, 02 Jul 2021 00:34:34 +0200
In-Reply-To: <2315db79-00cf-b2f0-b5df-93cd53392292@HIDDEN>
 (daanturo@HIDDEN's message of "Thu, 1 Jul 2021 19:40:20 +0700")
Message-ID: <87r1ghr7d1.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Provags-ID: V03:K1:+xjCzXpsFYn5/SBzZdChyEgOtckBJYO3uu2gVR3nLuxS+O5fBf4
 10YJTz8FsOL3lRAqPIvp9wGy0/0NrIHxDJzV1MLEVaxralZMmaBikV8mhY6UBx0KEeJlpbs
 tdaoiRxWsHjKsfSkelAv4hAe8P8pi6ZDBR6CZEw+uNmIdveRu/DOVXJNjXIl+KVUtbw7kze
 h5sXDOKTPh3rr9GuFFfww==
X-Spam-Flag: NO
X-UI-Out-Filterresults: notjunk:1;V03:K0:8jn68T6o85E=:2CRSLOL/IyuRSS4tAVnVJI
 if8oODRTh1snHaLFTZV25YRZTggpQom+gV27hC6Y5eZBOdi94rEnKBPHmUF8o3/dEEeXg2n/X
 HPcTB7krGVjynvXxL7SwBKFydXJyEKpjqXhFj93tBn7ykXSig9CyJAfwPtTMrbayQkCGJ3r7Q
 aAlb/74tAkWkJ5Rx53C64Ym4smUPeJZ0lq3dJDWqYvi8BbBSqYyJ5BZX0iSilWBQ2Ieg6ba+2
 LMn8xKSLuGkIgVVO/gfsHGRk/pOBYCeUjZuhUYdXefxI2sIRRFA7CgIs+mt5SUJAlfQ8La2C7
 Dwg9B7GD5iDXPkx35Z/lsoaqEE83Ok4XkLInLLoaCwroK69u+VAdPGkbTX0atXABtreOtgJ7h
 RXSzElhC8ukWqzdOK24PsD9Zfp2VXWSljk7XwON/93PpmtfBrH73ISgQGMzS2ooMPXu2LN29B
 5HfoAnl8tWA5aIWnJwW5oxHYpFMZI9KHpj6axd8f8r7prB1PpE9a1yYv3sW0uloUNxnZQIo/n
 Ekkqd5XYojd8nwAjQBMc2v2DgYqkB8EVUR9dNqQ9n+11fj80rFp3elTS03gN8nZnheMC6fbGN
 q25NQm+YosPodW7zUvDIYDXtUyw9n+PaM8YT2AS7MAy55RoXqZrqKSWL1B/FcNg9jmsDCru/I
 H9m2kgqTNrOEcfxLcQn47PNm+3qqvR5PYakemuysGYIweZxe+HOpdsLCkmx+G+TEX3ZhvwN8k
 cikgUpptpMDUUaCp7iTXcMPF52ggL7zJGamX9wRStSOhi49XwTgfeB+0xJrIu4DAIRKUlJ6Z1
 uTiUmk2zvtk+ljP4KxexlM1F4Ptti0YG3eXq0qDWnpuC7uCl/cLN8NG8V/6shrB2Y6Y88h1mt
 q2r4pzh06o+ABNT/4fL4Z//gIdyxEdEfRk9v/yTs9xkNbAerfqPamrjekZr4apzUHbJvG7MuI
 gzav4h8oZypzKKUO+SIkuMKU1+rhoakzRrhBO3dDjKSQcHchidf8JnB6JZcf818ZslmLY6c+r
 a5yPfX4nVUHhuQ1Bamlrdm0O+en7tKsf9n2y/7ES5OmRAFSzYfoWRMu9UvP6EO2iLA7GOeg0F
 tLXxGHTrH5EFk3BsMQgAwdT+zJFPbV5n/axtLjgK4BDDA6q/ykPS7WU+g==
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 49316
Cc: 49316 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

daanturo <daanturo@HIDDEN> writes:

| +(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.

I wonder: If we leave syntax aside for a moment - this suggestion seems
to provide a solution for a quite special case: is this useful more
often than partial application of arbitrary arguments?  Could we instead
provide something that allows partial application of arbitrary
arguments, e.g. one of the arguments in the middle?


Michael.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#49316; Package emacs. Full text available.

Message received at 49316 <at> debbugs.gnu.org:


Received: (at 49316) by debbugs.gnu.org; 1 Jul 2021 18:45:28 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jul 01 14:45:28 2021
Received: from localhost ([127.0.0.1]:33697 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1lz1gm-0002Q0-6e
	for submit <at> debbugs.gnu.org; Thu, 01 Jul 2021 14:45:28 -0400
Received: from eggs.gnu.org ([209.51.188.92]:46850)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1lz1gk-0002Pm-KZ
 for 49316 <at> debbugs.gnu.org; Thu, 01 Jul 2021 14:45:27 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e]:58286)
 by eggs.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <eliz@HIDDEN>)
 id 1lz1ge-0002kF-MI; Thu, 01 Jul 2021 14:45:20 -0400
Received: from 84.94.185.95.cable.012.net.il ([84.94.185.95]:4512
 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1lz1ge-00030Q-B6; Thu, 01 Jul 2021 14:45:20 -0400
Date: Thu, 01 Jul 2021 21:45:15 +0300
Message-Id: <834kddlvpg.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: daanturo <daanturo@HIDDEN>
In-Reply-To: <e780b390-eac8-e50e-afc5-72556349bf79@HIDDEN> (message from
 daanturo on Fri, 2 Jul 2021 00:06:35 +0700)
Subject: Re: bug#49316: Add apply-partially's right version
References: <2315db79-00cf-b2f0-b5df-93cd53392292@HIDDEN>
 <87czs2faas.fsf@HIDDEN> <daeadd8a-dc11-af17-c543-f7545e81b73b@HIDDEN>
 <e780b390-eac8-e50e-afc5-72556349bf79@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 49316
Cc: contovob@HIDDEN, 49316 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: daanturo <daanturo@HIDDEN>
> Date: Fri, 2 Jul 2021 00:06:35 +0700
> Cc: "Basil L. Contovounesios" <contovob@HIDDEN>
> 
> (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.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#49316; Package emacs. Full text available.

Message received at 49316 <at> debbugs.gnu.org:


Received: (at 49316) by debbugs.gnu.org; 1 Jul 2021 17:17:01 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jul 01 13:17:01 2021
Received: from localhost ([127.0.0.1]:33638 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1lz0JB-0008UK-Jv
	for submit <at> debbugs.gnu.org; Thu, 01 Jul 2021 13:17:01 -0400
Received: from mail-pl1-f172.google.com ([209.85.214.172]:33472)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <daanturo@HIDDEN>) id 1lz0JA-0008U1-DU
 for 49316 <at> debbugs.gnu.org; Thu, 01 Jul 2021 13:17:00 -0400
Received: by mail-pl1-f172.google.com with SMTP id f11so4062016plg.0
 for <49316 <at> debbugs.gnu.org>; Thu, 01 Jul 2021 10:17:00 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=subject:from:to:cc:references:message-id:date:user-agent
 :mime-version:in-reply-to:content-language;
 bh=AXR/Fqsf2wP3tTKugplkJSfRLW1nXmXAnMn9wjSPkSk=;
 b=ssMpg6o0PLnwFqJXyorxbKuQ2mMoAi6QG2Ky0YcOTuiXTISjWYSKDn4CclBFm8vZ/7
 zAbZ1x2Ds10+LgvsybfZwny9CwJsz1ioIyl0FOMX3ei4LLraJVMd3wvwfupHeaBxIguX
 0028nYBCHRZyTx/QC6c8d0h7+A2t8ZE/spyBgOkc403S5IxWVRqpF2787gBb+ki0LORs
 FiZHhzeCDXUiJZa3Mi//QuFEanpnLreLXHJLCKw4zIQbTwOyZRZerJ9xUdkAyc0M8fQI
 zEzjm3bCuETXECbrmhlmvfmXg0CovUFY3Q/j7tdS83twib/GlFAGsupzNLxZe4362irw
 XAWg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:subject:from:to:cc:references:message-id:date
 :user-agent:mime-version:in-reply-to:content-language;
 bh=AXR/Fqsf2wP3tTKugplkJSfRLW1nXmXAnMn9wjSPkSk=;
 b=U+XoAsOi2dvmn4mWKHugjVIj3OZgMRJGj2U9CEazyrS2u3mXyRY3z9hQZTrv1P6VXx
 uOJ7KpWUszYQBpojGWYk5cRKdzZwfmfJT29/9jfU/L36LG2uMfueOgIUCj3qO+vK2zMH
 /McJK4DsI77wD+Q0QQWPJQvg6dyOWdaRfD1jdGlJBURRFoyrI3THCg7v9LirgsHquCEn
 RknH7r4Lf+rGk6RDkmwmb01qTQYgY5/TmeBWq70FEo6BlfX9u0giy2ofDsLddKEPC7OY
 XTxU3iAgPnVv151o/sBWOeTUKCXuasYKCogAMdwjazkumEt/GzTDBt+XlGTPY1/r/m0M
 5Xvg==
X-Gm-Message-State: AOAM531tFnSigNdQuQkTfZhVE6ULZYnHZGc7oX0oOLJOUmcSY9xt4dXb
 jODcYKXqwD18S4Re2hFA22Y=
X-Google-Smtp-Source: ABdhPJxEK9lgVQrGAWsMabvP9PDPn5kVSK3i0eH6K+HdkD3dkMN8RZORl76cGX3WQw5yhdfjkm1oYg==
X-Received: by 2002:a17:90b:19c5:: with SMTP id
 nm5mr697549pjb.141.1625159814603; 
 Thu, 01 Jul 2021 10:16:54 -0700 (PDT)
Received: from ?IPv6:2402:800:630f:53b:ee3a:5256:1634:1e03?
 ([2402:800:630f:53b:ee3a:5256:1634:1e03])
 by smtp.gmail.com with ESMTPSA id y3sm242639pjg.28.2021.07.01.10.16.53
 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
 Thu, 01 Jul 2021 10:16:54 -0700 (PDT)
Subject: Re: bug#49316: Add apply-partially's right version
From: daanturo <daanturo@HIDDEN>
To: 49316 <at> debbugs.gnu.org
References: <2315db79-00cf-b2f0-b5df-93cd53392292@HIDDEN>
 <87czs2faas.fsf@HIDDEN> <daeadd8a-dc11-af17-c543-f7545e81b73b@HIDDEN>
 <e780b390-eac8-e50e-afc5-72556349bf79@HIDDEN>
Message-ID: <1f1bd484-5579-9128-1a3f-1a3b3799a0ef@HIDDEN>
Date: Fri, 2 Jul 2021 00:16:48 +0700
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101
 Thunderbird/78.11.0
MIME-Version: 1.0
In-Reply-To: <e780b390-eac8-e50e-afc5-72556349bf79@HIDDEN>
Content-Type: multipart/mixed; boundary="------------B2C3E9DCFE1F17B177516330"
Content-Language: en-US
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 49316
Cc: "Basil L. Contovounesios" <contovob@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

This is a multi-part message in MIME format.
--------------B2C3E9DCFE1F17B177516330
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit


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


Tags:  49316 + patch

Fix apply-rpartially's typo in etc/NEWS


--=-=-=
Content-Type: text/patch
Content-Disposition: attachment;
filename=0001-Fix-apply-rpartially-s-typo-in-etc-NEWS.patch

 From 002c1025b6aee1d112fe6b918384615b5ec9949c Mon Sep 17 00:00:00 2001
From: Daanturo <daanturo@HIDDEN>
Date: Fri, 2 Jul 2021 00:11:12 +0700
Subject: [PATCH] Fix apply-rpartially's typo in etc/NEWS

* etc/NEWS (Lisp Changes in Emacs 28.1): fix apply-rpartially's typo:
Funcionally -> Functionally
---
etc/NEWS | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/etc/NEWS b/etc/NEWS
index 252e6b4d0b..be30d6c859 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -2911,7 +2911,7 @@ The former is now declared obsolete.

+++
** New function 'apply-rpartially'.
-Funcionally equivalent to 'apply-partially' but arguments are aligned
+Functionally equivalent to 'apply-partially' but arguments are aligned
to the right instead.

+++
-- 
2.32.0


--=-=-=--

-- 
Daanturo.


--------------B2C3E9DCFE1F17B177516330
Content-Type: text/x-patch; charset=UTF-8;
 name="0001-Fix-apply-rpartially-s-typo-in-etc-NEWS.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="0001-Fix-apply-rpartially-s-typo-in-etc-NEWS.patch"

From 002c1025b6aee1d112fe6b918384615b5ec9949c Mon Sep 17 00:00:00 2001
From: Daanturo <daanturo@HIDDEN>
Date: Fri, 2 Jul 2021 00:11:12 +0700
Subject: [PATCH] Fix apply-rpartially's typo in etc/NEWS

* etc/NEWS (Lisp Changes in Emacs 28.1): fix apply-rpartially's typo:
  Funcionally -> Functionally
---
 etc/NEWS | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/etc/NEWS b/etc/NEWS
index 252e6b4d0b..be30d6c859 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -2911,7 +2911,7 @@ The former is now declared obsolete.
 
 +++
 ** New function 'apply-rpartially'.
-Funcionally equivalent to 'apply-partially' but arguments are aligned
+Functionally equivalent to 'apply-partially' but arguments are aligned
 to the right instead.
 
 +++
-- 
2.32.0


--------------B2C3E9DCFE1F17B177516330--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#49316; Package emacs. Full text available.

Message received at 49316 <at> debbugs.gnu.org:


Received: (at 49316) by debbugs.gnu.org; 1 Jul 2021 17:06:46 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jul 01 13:06:46 2021
Received: from localhost ([127.0.0.1]:33629 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1lz09G-0008Ac-5l
	for submit <at> debbugs.gnu.org; Thu, 01 Jul 2021 13:06:46 -0400
Received: from mail-pg1-f169.google.com ([209.85.215.169]:35802)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <daanturo@HIDDEN>) id 1lz09E-0008AK-RC
 for 49316 <at> debbugs.gnu.org; Thu, 01 Jul 2021 13:06:45 -0400
Received: by mail-pg1-f169.google.com with SMTP id v7so6709991pgl.2
 for <49316 <at> debbugs.gnu.org>; Thu, 01 Jul 2021 10:06:44 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=subject:from:to:cc:references:message-id:date:user-agent
 :mime-version:in-reply-to:content-language;
 bh=l9i+5+1Tick/1PfQO/GANiIHXn+Kd9eLfkJtZTfmmwA=;
 b=smlBoKcb4vIN8+eKwQfkCIvc0jRYUDEsf9RcO4SP7RqoOS0RuKLLe/E48FDsBja65g
 FsVmaKw/OIegMySlDRtuVplZkww2338wN/V/I9cwX9X/CIXEVJM80qWnObWo4IXRVyfQ
 G6vt5jLhghtY0fu8eGr9h+mglrk9c+sXIBOiV/5ZhQXoUsEDWx5BH39z+fW8WSaZK9MZ
 Zb913tRoeuex3j89l4mxM/8roaKKCuT8mTSoR5Sufw54ywbYYBpIBgQMuA65AaQoqJi1
 sr2FQsT7wPgZe6XHp+FTkgGU15OkFxUfpS6SyPawx0MVkK6typp/YM+MHizRm4c7pqc4
 91/w==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:subject:from:to:cc:references:message-id:date
 :user-agent:mime-version:in-reply-to:content-language;
 bh=l9i+5+1Tick/1PfQO/GANiIHXn+Kd9eLfkJtZTfmmwA=;
 b=B1UBPOk9jrVnfdzpi26+daCWvFC6Y3jYU6/eh5AZMxs0W+LI0Yr2f8tDzNz3U6nunO
 ce8PUhWxAeD6NRR/KbXJ6/rEbtiMfmAgMC4QbZVE1NCYuZClEF+0C7a+QCkc2zryhKw2
 YrGtcUoadfJpESo+PMOvo4kb40ApoBk3mXrPet/1yHGIfal7PbbHmFJeAVfiDN1N9jVA
 /D5NIuNzYenzJvcLsVz1hfo/nT2meDDZ9BEHspzwncCH/i3beYP+UCmX8yerqerCDsg1
 DAts79zpRiQw3FQ2nYzAWN4TFhbXGrDxStTTuZINoD0r8yo8H2yrqoY+H47hdv6dE69T
 FS9g==
X-Gm-Message-State: AOAM532HJgIlTAeSSNKXQR14c7+bdxw9AE3oeB1VH6EE+avJPLAtspNU
 bXBH+3FrfiQAvZNHZE5GzEY=
X-Google-Smtp-Source: ABdhPJzHKkDhTKmJtKXC0GpSRve4miRUGRE1+ud8LlP21JJ9no5OAmwuMjrps/Ei+H4Q/VohQdvwiQ==
X-Received: by 2002:aa7:9252:0:b029:2ae:bde3:621f with SMTP id
 18-20020aa792520000b02902aebde3621fmr1007905pfp.18.1625159198873; 
 Thu, 01 Jul 2021 10:06:38 -0700 (PDT)
Received: from ?IPv6:2402:800:630f:53b:ee3a:5256:1634:1e03?
 ([2402:800:630f:53b:ee3a:5256:1634:1e03])
 by smtp.gmail.com with ESMTPSA id i8sm524911pfo.154.2021.07.01.10.06.36
 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
 Thu, 01 Jul 2021 10:06:38 -0700 (PDT)
Subject: Re: bug#49316: Add apply-partially's right version
From: daanturo <daanturo@HIDDEN>
To: 49316 <at> debbugs.gnu.org
References: <2315db79-00cf-b2f0-b5df-93cd53392292@HIDDEN>
 <87czs2faas.fsf@HIDDEN> <daeadd8a-dc11-af17-c543-f7545e81b73b@HIDDEN>
Message-ID: <e780b390-eac8-e50e-afc5-72556349bf79@HIDDEN>
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
MIME-Version: 1.0
In-Reply-To: <daeadd8a-dc11-af17-c543-f7545e81b73b@HIDDEN>
Content-Type: multipart/mixed; boundary="------------9BFCF884AFB7166958B388F1"
Content-Language: en-US
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 49316
Cc: "Basil L. Contovounesios" <contovob@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

This is a multi-part message in MIME format.
--------------9BFCF884AFB7166958B388F1
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit


--=-=-=
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@HIDDEN>
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.


--------------9BFCF884AFB7166958B388F1
Content-Type: text/x-patch; charset=UTF-8;
 name="0002-Add-apply-rpartially-documents.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="0002-Add-apply-rpartially-documents.patch"

From b56a83f2765d3dfb1db011acc561bf107c934594 Mon Sep 17 00:00:00 2001
From: Daanturo <daanturo@HIDDEN>
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


--------------9BFCF884AFB7166958B388F1--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#49316; Package emacs. Full text available.

Message received at 49316 <at> debbugs.gnu.org:


Received: (at 49316) by debbugs.gnu.org; 1 Jul 2021 16:24:32 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jul 01 12:24:32 2021
Received: from localhost ([127.0.0.1]:33586 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1lyzUO-0006ql-4r
	for submit <at> debbugs.gnu.org; Thu, 01 Jul 2021 12:24:32 -0400
Received: from mail-pj1-f54.google.com ([209.85.216.54]:53189)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <daanturo@HIDDEN>) id 1lyzUN-0006qW-BF
 for 49316 <at> debbugs.gnu.org; Thu, 01 Jul 2021 12:24:31 -0400
Received: by mail-pj1-f54.google.com with SMTP id kt19so4582133pjb.2
 for <49316 <at> debbugs.gnu.org>; Thu, 01 Jul 2021 09:24:31 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=subject:to:cc:references:from:message-id:date:user-agent
 :mime-version:in-reply-to:content-language;
 bh=VeeyhrCHyfAAf8BkJM5nAsZxzbEbnrVWz+DabnMAqxk=;
 b=XGCscEcz+4yqBoUjDzL4HWe3EvFWO4P0mgNa6YtA0SWBWqHt7rZI7PFKe1vm85z87u
 eqi+RrVn84cyiTA8bJeKmAH0tZbZGtkmyKC8qEIQjErzZa1k3F5M/pZ0UsVqnrlUzjwG
 NE+IOnOeKqU5qGcudr/LnB99beDoneXXFPywmaQvpvJ4H0IMkrkjS5Dc+/HMV24qyBd8
 aRJ7ijj9Vvl5Dv6UxYwzdanbr28+A3E7SsEEhGDq5mbeMBLLDJ9MN5SZGpq/GRJ5+Cug
 sNdG2HBIKv9Rx2VpjbYDoy3wkvvep+Y5Pfo+VvicbR/QOG0llYfHupG59eUhC+SX3nkX
 zI7Q==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:subject:to:cc:references:from:message-id:date
 :user-agent:mime-version:in-reply-to:content-language;
 bh=VeeyhrCHyfAAf8BkJM5nAsZxzbEbnrVWz+DabnMAqxk=;
 b=ChPuAGtY3ZJT/H8FZEhj8tMaH7VN8f86LILxFmmkUgkDiK5iJvVHSTmVFFW+hk3k2J
 ZH4xMJIkCH5/BCR7Xpj47q/EtkGCgedfGidWRwK3PtVXp7mzeWuACcg/HcQFGVfXqDnX
 tl++y7MOZh4h2eBQpJ3iGSPgDyL0XWmVYEQ2I1Di3DygeaCh492rTQHbz5DM63U5mm0K
 r+E/A9MkM3JcaNoV9uZNxudff9POkaXnMYlS2odlClqY1zkRZPeRg81DkKNJk2r1ooVq
 x+yiu3VgSbIDU9nAAHyJBwOd5I6hbj9f6E4Zh/czfEW4f1pjor2Zw9+41Rvl7A0xtivS
 O0Fw==
X-Gm-Message-State: AOAM532rfONIk/oYRT5tmHVyXzD9Ii6NMMZoJ+VyxeqXqwZ6dTAwCz2R
 YsWjDYAvJBOZhfcQc+ifeRw=
X-Google-Smtp-Source: ABdhPJzlSrbfKfZKd+KQX80orAUfaCYDcQvCZjoLIvIzCGg+xP7TpSj0xC02eQakHBFeNyOoOnSD5Q==
X-Received: by 2002:a17:902:d4c6:b029:128:9982:511e with SMTP id
 o6-20020a170902d4c6b02901289982511emr588527plg.43.1625156665615; 
 Thu, 01 Jul 2021 09:24:25 -0700 (PDT)
Received: from ?IPv6:2402:800:630f:53b:ee3a:5256:1634:1e03?
 ([2402:800:630f:53b:ee3a:5256:1634:1e03])
 by smtp.gmail.com with ESMTPSA id o184sm352841pga.18.2021.07.01.09.24.24
 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
 Thu, 01 Jul 2021 09:24:25 -0700 (PDT)
Subject: Re: bug#49316: Add apply-partially's right version
To: 49316 <at> debbugs.gnu.org
References: <2315db79-00cf-b2f0-b5df-93cd53392292@HIDDEN>
 <87czs2faas.fsf@HIDDEN>
From: daanturo <daanturo@HIDDEN>
Message-ID: <daeadd8a-dc11-af17-c543-f7545e81b73b@HIDDEN>
Date: Thu, 1 Jul 2021 23:24:22 +0700
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101
 Thunderbird/78.11.0
MIME-Version: 1.0
In-Reply-To: <87czs2faas.fsf@HIDDEN>
Content-Type: multipart/mixed; boundary="------------FB754410FFEC91DC8766C690"
Content-Language: en-US
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 49316
Cc: "Basil L. Contovounesios" <contovob@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

This is a multi-part message in MIME format.
--------------FB754410FFEC91DC8766C690
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit


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

Thank you.


On 7/1/21 8:11 PM, Basil L. Contovounesios wrote:
> tags 49316 + patch
> quit
>
>>  From c594d6fc396b80019c48e63918f8c5e485f2782f Mon Sep 17 00:00:00 2001
>> From: Daanturo <daanturo@HIDDEN>
>> Date: Thu, 1 Jul 2021 19:21:08 +0700
>> Subject: [PATCH] Define apply-rpatially
>                                  ^^^^^^^^^
>                                  rpartially
>
>> Which is analogous to `apply-partially` but arguments are aligned on the right
>> instead.
> Nit: Missing changelog-style entry (see the guidelines in the file
> CONTRIBUTE), e.g.:
>
> * lisp/subr.el (apply-rpartially): New function.
>
>>   lisp/subr.el | 9 +++++++++
>>   1 file changed, 9 insertions(+)
> This feature would probably also warrant an announcement in etc/NEWS and
> a manual entry under (info "(elisp) Calling Functions").
>
> Thanks,
>
-- 
Daanturo.


--------------FB754410FFEC91DC8766C690
Content-Type: text/x-patch; charset=UTF-8;
 name="0002-Add-apply-rpartially-documents.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="0002-Add-apply-rpartially-documents.patch"

From b56a83f2765d3dfb1db011acc561bf107c934594 Mon Sep 17 00:00:00 2001
From: Daanturo <daanturo@HIDDEN>
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


--------------FB754410FFEC91DC8766C690
Content-Type: text/x-patch; charset=UTF-8;
 name="0001-Define-apply-rpartially.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="0001-Define-apply-rpartially.patch"

From 6af0d300d214c3fcf872641356a6c788b0aed771 Mon Sep 17 00:00:00 2001
From: Daanturo <daanturo@HIDDEN>
Date: Thu, 1 Jul 2021 22:03:05 +0700
Subject: [PATCH 1/2] Define apply-rpartially

* lisp/subr.el (apply-rpartially): New function 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


--------------FB754410FFEC91DC8766C690--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#49316; Package emacs. Full text available.
Added tag(s) patch. Request was from "Basil L. Contovounesios" <contovob@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 49316 <at> debbugs.gnu.org:


Received: (at 49316) by debbugs.gnu.org; 1 Jul 2021 13:12:06 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jul 01 09:12:06 2021
Received: from localhost ([127.0.0.1]:59923 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1lywUA-0007I6-9A
	for submit <at> debbugs.gnu.org; Thu, 01 Jul 2021 09:12:06 -0400
Received: from mail-wm1-f42.google.com ([209.85.128.42]:51150)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <contovob@HIDDEN>) id 1lywU7-0007HR-Lo
 for 49316 <at> debbugs.gnu.org; Thu, 01 Jul 2021 09:12:04 -0400
Received: by mail-wm1-f42.google.com with SMTP id o22so4507814wms.0
 for <49316 <at> debbugs.gnu.org>; Thu, 01 Jul 2021 06:12:03 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tcd.ie; s=google21;
 h=from:to:cc:subject:references:date:in-reply-to:message-id
 :user-agent:mime-version;
 bh=QoP3REFaNpWWg+WOhU3lbhvcvZ/1uCHiHmZXkc1XaUQ=;
 b=IfeuYobN9dfkCKa0pqRf0LiwvuvgrezaekN82jT1j5TlchQf3fvBqIxVf4WyAQX6ox
 +vfkjuMlJLj/viYNOX4VRVTsKfQ7B7bsk/kZJITfptwPG0NOcugRYjltyo/pHwOrQHEd
 5LG8lk+YivZSbhqIHSkPaiqdoP6bs+qJt52qzfBXfuElKdyKTgsz70YN4CuQjbqweZXt
 BIWr2I2mB35QIKC/bexAySEZxZRU+RSld0+mcVAEjGvnDEVMqkK+IzgszhTaNOB5x8rw
 hveDH+7BxR5Y8QYElPrz3HYs2F5a1fPRog56j6H9sMok9/G+bWJQtG4y0f6rSiCiijwB
 UK3A==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to
 :message-id:user-agent:mime-version;
 bh=QoP3REFaNpWWg+WOhU3lbhvcvZ/1uCHiHmZXkc1XaUQ=;
 b=LRgxJP4a+oyn/6TNn8rvtTXrqFgpLw5nNGCftcT5l2vIWRgg5rkoO7LfbVQn4ujXSv
 tMJCwls1iPxRnfGEpnQnJmAjcJDWdhxSOn5pDoaL6AKFbDWzpr5OAnH5ZZIGpZDzkYYu
 A4vCqN8lQymSu2dSCoL0JvXIhtAg5nEDOMKJ8HqB15M3FekVSkgmc5piRiBLsfa6PZ9E
 x40a0SsWJAoN40t2qtvwmwluJWpluiDt3GKJSwjAiRonb/v2pQDzL47Xpe8IEkxNs78h
 /elhQxZ/6vaXjkgdPnvsIsrg31YK4D21Eu3afrygyMWXlcjU11q6K4IQQfdrMDHNNhOb
 o8dg==
X-Gm-Message-State: AOAM531Z+h0Jtv+yKJjYJbye0+6BxCl9XMSawFBzBWosIxuwxpaYcvuF
 mhWuOMjdoPtavCnc70Cxs/u1tA==
X-Google-Smtp-Source: ABdhPJxmpCvwCDm6BKXqOA4RF7WTzb98BzWFI2ULJjuAfB6Lnd3Ab/u45MmuA8zsrvK6BCXs5bSWng==
X-Received: by 2002:a7b:c8c1:: with SMTP id f1mr19409753wml.135.1625145117861; 
 Thu, 01 Jul 2021 06:11:57 -0700 (PDT)
Received: from localhost ([51.37.48.130])
 by smtp.gmail.com with ESMTPSA id p7sm13131177wrr.68.2021.07.01.06.11.56
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 01 Jul 2021 06:11:57 -0700 (PDT)
From: "Basil L. Contovounesios" <contovob@HIDDEN>
To: daanturo <daanturo@HIDDEN>
Subject: Re: bug#49316: Add apply-partially's right version
References: <2315db79-00cf-b2f0-b5df-93cd53392292@HIDDEN>
Date: Thu, 01 Jul 2021 14:11:55 +0100
In-Reply-To: <2315db79-00cf-b2f0-b5df-93cd53392292@HIDDEN> (daanturo's
 message of "Thu, 1 Jul 2021 19:40:20 +0700")
Message-ID: <87czs2faas.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 49316
Cc: 49316 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

tags 49316 + patch
quit

> From c594d6fc396b80019c48e63918f8c5e485f2782f Mon Sep 17 00:00:00 2001
> From: Daanturo <daanturo@HIDDEN>
> Date: Thu, 1 Jul 2021 19:21:08 +0700
> Subject: [PATCH] Define apply-rpatially
                                ^^^^^^^^^
                                rpartially

> Which is analogous to `apply-partially` but arguments are aligned on the right
> instead.

Nit: Missing changelog-style entry (see the guidelines in the file
CONTRIBUTE), e.g.:

* lisp/subr.el (apply-rpartially): New function.

>  lisp/subr.el | 9 +++++++++
>  1 file changed, 9 insertions(+)

This feature would probably also warrant an announcement in etc/NEWS and
a manual entry under (info "(elisp) Calling Functions").

Thanks,

-- 
Basil




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#49316; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 1 Jul 2021 12:40:30 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jul 01 08:40:30 2021
Received: from localhost ([127.0.0.1]:59858 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1lyvza-0006VT-Cj
	for submit <at> debbugs.gnu.org; Thu, 01 Jul 2021 08:40:30 -0400
Received: from lists.gnu.org ([209.51.188.17]:47414)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <daanturo@HIDDEN>) id 1lyvzY-0006VK-RU
 for submit <at> debbugs.gnu.org; Thu, 01 Jul 2021 08:40:29 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:34236)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <daanturo@HIDDEN>)
 id 1lyvzY-0006zH-Jj
 for bug-gnu-emacs@HIDDEN; Thu, 01 Jul 2021 08:40:28 -0400
Received: from mail-pj1-x102a.google.com ([2607:f8b0:4864:20::102a]:39743)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <daanturo@HIDDEN>)
 id 1lyvzW-0004VD-P3
 for bug-gnu-emacs@HIDDEN; Thu, 01 Jul 2021 08:40:28 -0400
Received: by mail-pj1-x102a.google.com with SMTP id
 in17-20020a17090b4391b0290170ba0ec7fcso6550041pjb.4
 for <bug-gnu-emacs@HIDDEN>; Thu, 01 Jul 2021 05:40:24 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=to:subject:from:message-id:date:user-agent:mime-version
 :content-language;
 bh=oPp+ZCoJLNodPoXYNTUAhtv+ToJ0LxCyfSe2Qf2+v1M=;
 b=WaGUwkMHJRBMhAMNYERToTiAexUIn9QyBL25PcKvo2siLBI+EZdn2zX/YoZj7XQvUX
 bIkJlWdQaOhKKcTfaxb8tjtzWQCTt0uRExWQ5smxK6nmvFC897j1y8mOnEGJZUqiROhH
 w2m+1z3h/HcUkSmf98T5t93Ye7wJtQnYXZl8DJyEyubE6y+u99MCdUacaX2KyyG3vanJ
 5GmkghNTjOiWZaSj5UYuFT7nkSbXcLGjcebXQltVlYh/+KAEvzJVwOeRXq1LLnei5PUl
 q3jl81UpjgrnX7umtdux26S7UfaFhXwUce/+R5RfOdg6fj5swOUoU5lCkVl/MAuqCu6Y
 CzIQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:to:subject:from:message-id:date:user-agent
 :mime-version:content-language;
 bh=oPp+ZCoJLNodPoXYNTUAhtv+ToJ0LxCyfSe2Qf2+v1M=;
 b=uYNvpG3RcHAC5zO5mgBXvP6AdQSDSHLxmK5fbR8ZVWLnn7wMrUPbNBz77Wi9mKyNWH
 iKOU/ycNGJNEv2Hi2HlqvONb9S0lpdfcJ8xFh0uZrk78geCbOc4uf8g2z9/3jJ9puUzN
 F/fqMQtphWSG1Q1qq7jKgHpGDDRknJxLXuqLoysMFxd5p+GNg+abWflOPkGO776bLFZI
 RadwIKgv3bQIeX5gpEBSEjRqNnXhZ7449fTl+M3P6tPx5Xwdo+3uQEHn8YxLjvgijK37
 yBulTB+XQ122mBcflcd0vhO9ZxYK+3086tiMso1uByBKfnD6LnCGn2B3TNDkQC0NopKA
 c2iA==
X-Gm-Message-State: AOAM531pOqms7LZNhCp0/iU3NagqhHhD4dz5i/0QmWjTCwKXTcDkxV15
 t79kAQJq8JZ6MDkpgfGC7F6BUc7ogGqEGw==
X-Google-Smtp-Source: ABdhPJz3QzTp3c3wgHLIWUyEudBIori1C0oVFcyLjPIsP0ZKQxSozR8r5EbWTCp0+F5o2lgzWOq3Sw==
X-Received: by 2002:a17:90a:bd04:: with SMTP id
 y4mr9921137pjr.127.1625143223366; 
 Thu, 01 Jul 2021 05:40:23 -0700 (PDT)
Received: from ?IPv6:2402:800:630f:53b:ee3a:5256:1634:1e03?
 ([2402:800:630f:53b:ee3a:5256:1634:1e03])
 by smtp.gmail.com with ESMTPSA id m1sm10362731pjk.35.2021.07.01.05.40.21
 for <bug-gnu-emacs@HIDDEN>
 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
 Thu, 01 Jul 2021 05:40:22 -0700 (PDT)
To: bug-gnu-emacs@HIDDEN
Subject: Add apply-partially's right version
From: daanturo <daanturo@HIDDEN>
Message-ID: <2315db79-00cf-b2f0-b5df-93cd53392292@HIDDEN>
Date: Thu, 1 Jul 2021 19:40:20 +0700
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101
 Thunderbird/78.11.0
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="------------2B31632080D50694645E39E6"
Content-Language: en-US
Received-SPF: pass client-ip=2607:f8b0:4864:20::102a;
 envelope-from=daanturo@HIDDEN; helo=mail-pj1-x102a.google.com
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001,
 RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.3 (-)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.3 (--)

This is a multi-part message in MIME format.
--------------2B31632080D50694645E39E6
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit


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

Tags: patch


Define apply-rpartial.

The equivalent function in dash.el is widely used by other packages so
it's beneficial to include it by default.



In GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 
3.24.29, cairo version 1.17.4)
of 2021-06-25 built on c6
Repository revision: e288348c0a785537d95b7ef2fff0cda729a29677
Repository branch: makepkg
Windowing system distributor 'System Description: Arch Linux

Configured using:
'configure --prefix=/usr --sysconfdir=/etc --libexecdir=/usr/lib
--localstatedir=/var --mandir=/usr/share/man --with-gameuser=:games
--with-sound=alsa --with-modules --without-gconf --without-gsettings
--with-native-compilation --with-pgtk --with-x-toolkit=gtk3
--without-xaw3d --without-m17n-flt --with-cairo --with-xwidgets
--without-compress-install 'CFLAGS=-march=x86-64 -mtune=generic -O2
-pipe -fno-plt -fexceptions -Wp,-D_FORTIFY_SOURCE=2 -Wformat
-Werror=format-security -fstack-clash-protection -fcf-protection -g
-fuse-ld=gold -g -fuse-ld=gold'
LDFLAGS=-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now'


--=-=-=
Content-Type: text/patch
Content-Disposition: attachment; filename=0001-Define-apply-rpatially.patch

 From c594d6fc396b80019c48e63918f8c5e485f2782f Mon Sep 17 00:00:00 2001
From: Daanturo <daanturo@HIDDEN>
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


--=-=-=--

-- 
Daanturo.


--------------2B31632080D50694645E39E6
Content-Type: text/x-patch; charset=UTF-8;
 name="0001-Define-apply-rpatially.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="0001-Define-apply-rpatially.patch"

From c594d6fc396b80019c48e63918f8c5e485f2782f Mon Sep 17 00:00:00 2001
From: Daanturo <daanturo@HIDDEN>
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


--------------2B31632080D50694645E39E6--




Acknowledgement sent to daanturo <daanturo@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#49316; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Fri, 2 Jul 2021 16:45:01 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.