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

Previous Next

Package: emacs;

Reported by: daanturo <daanturo <at> gmail.com>

Date: Thu, 1 Jul 2021 12:41:02 UTC

Severity: normal

Tags: patch, wontfix

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


Message #85 received at 49316 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: contovob <at> tcd.ie, Eli Zaretskii <eliz <at> gnu.org>,
 Stefan Kangas <stefan <at> marxist.se>, daanturo <at> gmail.com, 49316 <at> debbugs.gnu.org
Subject: Re: bug#49316: Add apply-partially's right version
Date: Sun, 24 Oct 2021 10:28:14 -0400
Lars Ingebrigtsen [2021-10-24 15:47:00] wrote:
> Eli Zaretskii <eliz <at> gnu.org> writes:
>> As for the rest, I'd like Lars to state his opinion about this new
>> function.  AFAICT, he didn't say what he thinks here.
>
> I'm not very enthusiastic -- is partial application used a lot now that
> we've got lexical binding?  Partial application has always seemed like
> One Weird Trick to me.

Like Stefan, I don't find partial application weird.
But I'm not sure what's the advantage of

    (apply-rpartially #'foo x y)

over

    (lambda (a b) (foo a b x y))

It's not necessarily shorter, it's less flexible (the lambda form lets
you pass args in the middle), and it's less efficient (it necessarily
relies on `&rest`, `append/nconc` and `apply`, which imply allocating
lists).

[ And with prettify-symbols-mode the lambda version is even shorter.  ]

> On the other hand -- some people are used to programming using these
> idioms, so perhaps it makes sense to add a right version as well?

`apply-partially` was handy before we had `lexical-binding`, but
I wouldn't have added it to Emacs after Emacs-24.
We already have `dash.el` for those users who like this style.


        Stefan





This bug report was last modified 3 years and 211 days ago.

Previous Next


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