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


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

From: Eshel Yaron <me <at> eshelyaron.com>
To: Stefan Kangas <stefankangas <at> gmail.com>
Cc: Stefan Monnier <monnier <at> iro.umontreal.ca>, 76413 <at> debbugs.gnu.org
Subject: Re: bug#76413: [PATCH] New macro 'compf' for composing functions
Date: Wed, 19 Feb 2025 20:00:14 +0100
Hi Stefan,

Stefan Kangas <stefankangas <at> gmail.com> writes:

> Eshel Yaron via "Bug reports for GNU Emacs, the Swiss army knife of text
> editors" <bug-gnu-emacs <at> gnu.org> writes:
>
>> Tags: patch
>>
>> This patch adds a new macro 'compf' that streamlines the common pattern
>> of function composition.
>>
>> Namely, instead of (lambda (x) (foo (bar (baz x)))), with this macro we
>> can write (compf foo bar baz), which expands to exactly the same form.
>
> 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.

> 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?


Thanks,

Eshel




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.