GNU bug report logs - #76476
Make cl-first, cl-second, ..., cl-tenth part of Emacs Lisp

Previous Next

Package: emacs;

Reported by: Stefan Kangas <stefankangas <at> gmail.com>

Date: Fri, 21 Feb 2025 18:42:02 UTC

Severity: wishlist

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

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Howard Melman <hmelman <at> gmail.com>
To: 76476 <at> debbugs.gnu.org
Subject: bug#76476: Make cl-first, cl-second, ..., cl-tenth part of Emacs Lisp
Date: Sun, 23 Feb 2025 12:57:31 -0500
Stefan Monnier via "Bug reports for GNU Emacs, the Swiss
army knife of text editors" <bug-gnu-emacs <at> gnu.org> writes:

>> I propose making the following functions from cl-lib.el a part of
>> Emacs Lisp proper (i.e. defined in subr.el):
>>
>>     first
>>     second
>>     third
>>     fourth
>>     fifth
>>     sixth
>>     seventh
>>     eight
>>     ninth
>>     tenth
>>     rest
>
> FWIW, I hate those even more than the `cadar` thingies.  🙂
>
> For direct calls, `nth` is always a better choice (except for `first`
> and `rest`, of course, where `car/cdr` would be the replacement), so the
> only use case is when you pass them as arg somewhere, but that doesn't
> seem to be very frequent.

I like these for the case where something returns a sequence
and the documentation (particularly docstrings) refers to
"the third element is...". In this situation, nth being
zero-indexed makes off-by-one errors more likely.

-- 

Howard





This bug report was last modified 142 days ago.

Previous Next


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