GNU bug report logs - #76413
[PATCH] New macro 'compf' for composing functions

Previous Next

Package: emacs;

Reported by: Eshel Yaron <me <at> eshelyaron.com>

Date: Wed, 19 Feb 2025 13:53:02 UTC

Severity: wishlist

Tags: patch

Full log


View this message in rfc822 format

From: Stefan Kangas <stefankangas <at> gmail.com>
To: Eshel Yaron <me <at> eshelyaron.com>
Cc: Stefan Monnier <monnier <at> iro.umontreal.ca>, 76413 <at> debbugs.gnu.org
Subject: bug#76413: [PATCH] New macro 'compf' for composing functions
Date: Sun, 23 Feb 2025 00:13:45 +0000
Eshel Yaron <me <at> eshelyaron.com> writes:

>> Why not name it `compose` as in CL and ELisp?
>
> It's a slightly different construct then Common Lisp's compose, so I
> feel like calling it by that name could lead to wrong expectations.
> Another option is fcomp instead of compf, BTW, if that seems better.

If it is different, then I agree that a different name is in probably in
order.  But see below.

>> How about a function with a compiler macro?
>
> That's a valid alternative, but it'd require quoting function names,
> which is slightly less concise/convenient.
>
> Do you see a clear advantage for using a function in this case?

It's slightly less typing, but also risks being more unclear, as it has
different evaluation rules.  The name `compf` is similarly fine, but to
me comes off as a little bit cryptic.

I think allowing function names to be in variables is also more general
and thus flexible, for instance supporting things like:

    (let ((fun #'some-function))
      (mapcar (compose #'not fun) some-list))

I also forgot to say thanks for digging up the old thread and this idea.
It had completely fallen off my radar.




This bug report was last modified 167 days ago.

Previous Next


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