From unknown Sat Aug 16 16:22:24 2025 X-Loop: help-debbugs@gnu.org Subject: bug#23736: Add companion to apply-partially Resent-From: Rasmus Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 09 Jun 2016 14:03:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 23736 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 23736@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.146548094615489 (code B ref -1); Thu, 09 Jun 2016 14:03:01 +0000 Received: (at submit) by debbugs.gnu.org; 9 Jun 2016 14:02:26 +0000 Received: from localhost ([127.0.0.1]:34747 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bB0XR-00041l-Up for submit@debbugs.gnu.org; Thu, 09 Jun 2016 10:02:26 -0400 Received: from eggs.gnu.org ([208.118.235.92]:39232) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bB0XP-00041Y-VM for submit@debbugs.gnu.org; Thu, 09 Jun 2016 10:02:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bB0XK-0006uy-1R for submit@debbugs.gnu.org; Thu, 09 Jun 2016 10:02:18 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: *** X-Spam-Status: No, score=3.5 required=5.0 tests=BAYES_50,FREEMAIL_FROM, FSL_HELO_BARE_IP_2,RCVD_NUMERIC_HELO autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:55532) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bB0XJ-0006ur-UG for submit@debbugs.gnu.org; Thu, 09 Jun 2016 10:02:17 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58419) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bB0XH-00047i-Ne for bug-gnu-emacs@gnu.org; Thu, 09 Jun 2016 10:02:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bB0XC-0006sC-O1 for bug-gnu-emacs@gnu.org; Thu, 09 Jun 2016 10:02:14 -0400 Received: from plane.gmane.org ([80.91.229.3]:48078) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bB0XC-0006r3-HT for bug-gnu-emacs@gnu.org; Thu, 09 Jun 2016 10:02:10 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1bB0X9-0005Qz-Hg for bug-gnu-emacs@gnu.org; Thu, 09 Jun 2016 16:02:07 +0200 Received: from 46.166.188.199 ([46.166.188.199]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 09 Jun 2016 16:02:07 +0200 Received: from rasmus by 46.166.188.199 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 09 Jun 2016 16:02:07 +0200 X-Injected-Via-Gmane: http://gmane.org/ From: Rasmus Date: Thu, 09 Jun 2016 16:01:59 +0200 Lines: 27 Message-ID: <87mvmuzciw.fsf@gmx.us> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 46.166.188.199 Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAAAAAByaaZbAAAAAmJLR0QA/4ePzL8AAAAJcEhZ cwAAAEgAAABIAEbJaz4AAAEySURBVEjH7ZXRbcMwDETNhW4T7sJJuAtH4Tj31w8jEanIkAoU7U+F AGYUvfDuLMuXfHNcvwwA7w8EmOoZgGUyk0wmM+8LRx3ogHE3vAKI7XpaBQ7WN0lBMtxUVTV4X3up zbSRqfJuhleZo2yx6qufiAhGXcoGIO8A7qHji9b5AjijzMSdhoiIrwEwS2NkFgu2ApxaJmy0A9sv o0Ob9Wohsd2tyPGvfgIoR/TB3D8PJTFkS28NgNXCAWAlGDsBovj0A6CpiAPAiwXkHkAWCyeAsVgA ub1xTfUBoCwWRMmHzVctlxX6PiiegEmDsjVcAM4WyxZAdgng0vV0VKLflIXrASTZ9v8N+CNgH6HE UlM/jKene6XpqgJi3rrdVZcU9XgdLezRA8w+EjHXP3+L/gM/BHwBRqZ1peGC4k8AAAAASUVORK5C YII= User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux) Cancel-Lock: sha1:NcaSTfo9Jj4l/YCNRRtHAACa7Ao= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -1.5 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.0 (---) Hi, Could we add an ‘apply-rpartially’ or ‘apply-partially-last’ to subr.el? Like ‘apply-partially’, but fixing the last arguments. This is useful for e.g. ‘set-face-attribute’ where one might a common :inherits to many faces, e.g. (mapc (apply-rpartially ’set-face-attribute :inherit ’fixed-pitch) ’(list of faces)) I have used this in my init.el, (defun apply-rpartially (fun &rest args) "Return a function that is a partial application of FUN to ARGS. 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)))) If that’s good I can prepare a patch that also has documentation. (I couldn’t find past discussions about such a function) Rasmus -- Don't slow down Johnny, leave the Cadillac runnin' From unknown Sat Aug 16 16:22:24 2025 X-Loop: help-debbugs@gnu.org Subject: bug#23736: Add companion to apply-partially Resent-From: Lars Ingebrigtsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 28 Jul 2019 12:07:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 23736 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Rasmus Cc: 23736@debbugs.gnu.org Received: via spool by 23736-submit@debbugs.gnu.org id=B23736.156431556324570 (code B ref 23736); Sun, 28 Jul 2019 12:07:02 +0000 Received: (at 23736) by debbugs.gnu.org; 28 Jul 2019 12:06:03 +0000 Received: from localhost ([127.0.0.1]:45866 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hrhwA-0006OE-Ob for submit@debbugs.gnu.org; Sun, 28 Jul 2019 08:06:03 -0400 Received: from quimby.gnus.org ([80.91.231.51]:54842) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hrhw9-0006Nn-7W for 23736@debbugs.gnu.org; Sun, 28 Jul 2019 08:06:01 -0400 Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=marnie) by quimby.gnus.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hrhw4-0003kZ-Dl; Sun, 28 Jul 2019 14:05:58 +0200 From: Lars Ingebrigtsen References: <87mvmuzciw.fsf@gmx.us> Date: Sun, 28 Jul 2019 14:05:55 +0200 In-Reply-To: <87mvmuzciw.fsf@gmx.us> (rasmus@gmx.us's message of "Thu, 09 Jun 2016 16:01:59 +0200") Message-ID: <87zhkybbz0.fsf@mouse.gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Rasmus writes: > Could we add an =?UTF-8?Q?=E2=80=98apply-rpartially=E2=80=99?= or =?UTF-8?Q?=E2=80=98apply-partially-last=E2=80=99?= to subr.el? > Like =?UTF-8?Q?=E2=80=98apply-partially=E2=80=99,?= but fixing the last arguments. This is useful for > e.g. =?UTF-8?Q?=E2=80=98set-face-attribute=E2=80=99?= where [...] Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Rasmus writes: > Could we add an =E2=80=98apply-rpartially=E2=80=99 or =E2=80=98apply-part= ially-last=E2=80=99 to subr.el? > Like =E2=80=98apply-partially=E2=80=99, but fixing the last arguments. T= his is useful for > e.g. =E2=80=98set-face-attribute=E2=80=99 where one might a common :inher= its to many > faces, e.g. > > (mapc (apply-rpartially =E2=80=99set-face-attribute :inherit =E2=80= =99fixed-pitch) =E2=80=99(list of faces)) > > I have used this in my init.el, > > (defun apply-rpartially (fun &rest args) > "Return a function that is a partial application of FUN to ARGS. > 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)))) (I'm going through old Emacs bug reports that haven't received any response.) I think this sounds like a slightly too obscure function to add to Emacs core. apply-partially is more useful because functions are often constructed in ways that makes that a convenient function, while the opposite order is more unusual, I think? (And especially with lexical support doing this sort of thing is often easier, anyway.) So I'm closing this as a "wontfix". --=20 (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From debbugs-submit-bounces@debbugs.gnu.org Sun Jul 28 08:06:06 2019 Received: (at control) by debbugs.gnu.org; 28 Jul 2019 12:06:06 +0000 Received: from localhost ([127.0.0.1]:45869 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hrhwE-0006OU-9m for submit@debbugs.gnu.org; Sun, 28 Jul 2019 08:06:06 -0400 Received: from quimby.gnus.org ([80.91.231.51]:54860) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hrhwD-0006ON-8e for control@debbugs.gnu.org; Sun, 28 Jul 2019 08:06:05 -0400 Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=marnie) by quimby.gnus.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hrhwA-0003kj-Oy for control@debbugs.gnu.org; Sun, 28 Jul 2019 14:06:04 +0200 Date: Sun, 28 Jul 2019 14:06:02 +0200 Message-Id: <87y30ibbyt.fsf@mouse.gnus.org> To: control@debbugs.gnu.org From: Lars Ingebrigtsen Subject: control message for bug #23736 X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: tags 23736 wontfix close 23736 quit Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) tags 23736 wontfix close 23736 quit From unknown Sat Aug 16 16:22:24 2025 X-Loop: help-debbugs@gnu.org Subject: bug#23736: Add companion to apply-partially Resent-From: "Basil L. Contovounesios" Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 28 Jul 2019 14:00:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 23736 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: wontfix To: Lars Ingebrigtsen Cc: 23736@debbugs.gnu.org, Rasmus Received: via spool by 23736-submit@debbugs.gnu.org id=B23736.156432238828316 (code B ref 23736); Sun, 28 Jul 2019 14:00:02 +0000 Received: (at 23736) by debbugs.gnu.org; 28 Jul 2019 13:59:48 +0000 Received: from localhost ([127.0.0.1]:46910 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hrjiF-0007Me-P2 for submit@debbugs.gnu.org; Sun, 28 Jul 2019 09:59:48 -0400 Received: from mail-wr1-f66.google.com ([209.85.221.66]:46069) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hrjiA-0007MP-MA for 23736@debbugs.gnu.org; Sun, 28 Jul 2019 09:59:46 -0400 Received: by mail-wr1-f66.google.com with SMTP id f9so58979678wre.12 for <23736@debbugs.gnu.org>; Sun, 28 Jul 2019 06:59:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tcd-ie.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-transfer-encoding; bh=J1EQUax9m6Kh7+AzuKZluZMD0Qu76JDBnmp4rBo/LGQ=; b=ywu1tZEUJk774tlr/vOo+13n6L35EOwPhHuX2B7Q9XGHf5sL1d2597TVB/gUUnfUIe ctUePo2L+EncEJPEC5X1Wy895BaPvbaHBo3mWag3elnPLQfu/aZSMwkAsnKT7GdIeRZp /BMMK46NhhkDqyleRizHeQm7fGZ3ag2RV1gINe389TXhUj/751JbuaXN6vNJqRJQCwXT SALBP02lHD6PLaxb+ewhJ7uHjHldWb6PDI0Yx7Y0G598OY5h7MCktQXjB+eGsoNicH1f yZ8Cn9W4k4vVsCr+R1HA9IusrDcYy5NHnmhWMQCnC3MEVxh3X0oXiOT/MMCd1pWFAil9 B+gQ== 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:content-transfer-encoding; bh=J1EQUax9m6Kh7+AzuKZluZMD0Qu76JDBnmp4rBo/LGQ=; b=HKmMBbI3eHUir9jqko8vdxZAbdJO8p5CiWP8Qyky8DzzXu/EFMsFLorh4MsLuyBuQo CO+Okarixeh4WPFxDn1uNXLFDZvBtRkydWpb/pXAsXLTvuRWVI5Wl0It8W7YayvBjZJ0 BW1ZVmgl0OhnFPmOOozbc4YiZZqKkVzZLmP1RF2K6rMkubOMz/q02gMqoMyzWAVoH+JZ 8LM1fiHzNYCeeThV1AxyvCWCR8adtaTWHB0PQkG4Tqk3SBoRhsCohnmP1YDmW1c7iLE1 PIah17nZ4bvGm4hbstKsyljiwUJDB6zsjapJwb3MkliOIWvYziGXji4uQ29faeH5QaGc eGLg== X-Gm-Message-State: APjAAAUupJNZ20uuI8bAKqMCystOo9S95ZvcSofmkejkBGx9IoUiMp/q 38SFswUdIA/skLPT4XjzhLrXRg== X-Google-Smtp-Source: APXvYqwXGfgiYa72V6y3ntXlhKY2JjCDqkFxyx1eJIWJMQyy74303qrhMfziwjV9z2ApQFaY+OU/Yg== X-Received: by 2002:a5d:4e08:: with SMTP id p8mr38575501wrt.20.1564322376802; Sun, 28 Jul 2019 06:59:36 -0700 (PDT) Received: from localhost ([2a02:8084:20e2:c380:1f68:7ff5:120d:64e]) by smtp.gmail.com with ESMTPSA id t15sm51099448wrx.84.2019.07.28.06.59.35 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Sun, 28 Jul 2019 06:59:35 -0700 (PDT) From: "Basil L. Contovounesios" References: <87mvmuzciw.fsf@gmx.us> <87zhkybbz0.fsf@mouse.gnus.org> Date: Sun, 28 Jul 2019 14:59:34 +0100 In-Reply-To: <87zhkybbz0.fsf@mouse.gnus.org> (Lars Ingebrigtsen's message of "Sun, 28 Jul 2019 14:05:55 +0200") Message-ID: <87r26al0op.fsf@tcd.ie> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Lars Ingebrigtsen writes: > Rasmus writes: > >> Could we add an =E2=80=98apply-rpartially=E2=80=99 or =E2=80=98apply-par= tially-last=E2=80=99 to subr.el? >> Like =E2=80=98apply-partially=E2=80=99, but fixing the last arguments. = This is useful for >> e.g. =E2=80=98set-face-attribute=E2=80=99 where one might a common :inhe= rits to many >> faces, e.g. >> >> (mapc (apply-rpartially =E2=80=99set-face-attribute :inherit =E2=80= =99fixed-pitch) =E2=80=99(list of faces)) >> >> I have used this in my init.el, >> >> (defun apply-rpartially (fun &rest args) >> "Return a function that is a partial application of FUN to ARGS. >> 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)))) > > (I'm going through old Emacs bug reports that haven't received any > response.) > > I think this sounds like a slightly too obscure function to add to Emacs > core. apply-partially is more useful because functions are often > constructed in ways that makes that a convenient function, while the > opposite order is more unusual, I think? Indeed I think partial application from the right is not as generally useful in languages with variadic functions. IME it is often replaced with shorthand for closures or currying from the right. In the case of Elisp there is also the issue that apply-partially is both a little verbose and (currently) significantly less efficient than an open-coded closure. --=20 Basil