From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Phil Sainty Newsgroups: gmane.emacs.bugs Subject: bug#49316: Add apply-partially's right version Date: Sun, 04 Jul 2021 02:13:53 +1200 Message-ID: <8b10e4966ad9a1f621b5d9a6b069c7c7@webmail.orcon.net.nz> References: <2315db79-00cf-b2f0-b5df-93cd53392292@gmail.com> <87r1ghr7d1.fsf@web.de> <5a08f089-3a19-d747-5098-4751c92a5b79@gmail.com> <875yxsxfit.fsf@web.de> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="30510"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Orcon Webmail Cc: daanturo , 49316@debbugs.gnu.org To: Michael Heerdegen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jul 03 16:15:31 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lzgQd-0007lA-IU for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 03 Jul 2021 16:15:31 +0200 Original-Received: from localhost ([::1]:34058 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lzgQc-0004rc-33 for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 03 Jul 2021 10:15:30 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:38658) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lzgQA-0004rT-VB for bug-gnu-emacs@gnu.org; Sat, 03 Jul 2021 10:15:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:56331) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lzgQA-0005dD-MV for bug-gnu-emacs@gnu.org; Sat, 03 Jul 2021 10:15:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lzgQA-0000AF-EZ for bug-gnu-emacs@gnu.org; Sat, 03 Jul 2021 10:15:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Phil Sainty Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 03 Jul 2021 14:15:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 49316 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 49316-submit@debbugs.gnu.org id=B49316.1625321645546 (code B ref 49316); Sat, 03 Jul 2021 14:15:02 +0000 Original-Received: (at 49316) by debbugs.gnu.org; 3 Jul 2021 14:14:05 +0000 Original-Received: from localhost ([127.0.0.1]:39644 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lzgPE-00008k-Pb for submit@debbugs.gnu.org; Sat, 03 Jul 2021 10:14:05 -0400 Original-Received: from smtp-3.orcon.net.nz ([60.234.4.44]:38507) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lzgP9-000082-F6 for 49316@debbugs.gnu.org; Sat, 03 Jul 2021 10:14:03 -0400 Original-Received: from [10.253.37.70] (port=16702 helo=webmail.orcon.net.nz) by smtp-3.orcon.net.nz with esmtpa (Exim 4.90_1) (envelope-from ) id 1lzgP4-00006t-0V; Sun, 04 Jul 2021 02:13:54 +1200 Original-Received: from ip-116-251-162-85.kinect.net.nz ([116.251.162.85]) via [10.253.37.253] by webmail.orcon.net.nz with HTTP (HTTP/1.1 POST); Sun, 04 Jul 2021 02:13:53 +1200 In-Reply-To: <875yxsxfit.fsf@web.de> X-Sender: psainty@orcon.net.nz X-GeoIP: -- X-Spam_score: -2.9 X-Spam_score_int: -28 X-Spam_bar: -- X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:209366 Archived-At: On 2021-07-03 15:06, Michael Heerdegen wrote: > A placeholder (e.g. the symbol `_' which should normally be unbound) > stands for an argument that is used from the args provided in the > actual > call: > > (defalias 'my-list-with-some-elts > (applying-partially (list 0 _ 2 _ 4))) > > (my-list-with-some-elts 'a 'b 'c 'd) ; => (0 a 2 b 4 c d) I like the flexibility of the placeholder approach. I'm not sold on the extra parens used here -- I don't feel too strongly about it, but it's inconsistent with how `apply-partially' is called. Similarly, being a macro is inconsistent, and eliminates the ability to apply an arbitrary list of arguments to this, which may be a useful thing to be able to do. (It's syntactic sugar though, so we don't *need* to account for all scenarios -- other use-cases can use the same approaches they do now.) It's slightly problematic that any chosen placeholder might be a valid argument to the function in question. An underscore feels as good a choice as any other, though, and provides the mental association with the conventional use of an underscore for unused arguments. I suppose this issue is partly mitigated if it does end up being a macro, as we can't then apply some unknown list of args (which might happen to include the placeholder value). I think this is useful enough to implement regardless of that last issue, and it could simply be documented that it shouldn't be used in cases where the arguments are unknown, or where an underscore (or whatever placeholder is chosen) is a valid arg. -Phil