Subject: bug#76476: Make cl-first, cl-second, ..., cl-tenth part of Emacs Lisp

From: Stefan Kangas <[email-masked]>
Date: Fri, 21 Feb 2025 18:40:46 +0000

Severity: wishlist

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

This would allow converting code such as:

    (mapcar (lambda (thing) (car (cdr (cdr (cdr thing))))) ...)
    (mapcar (lambda (thing) (cadddr thing)) ...)
    (mapcar (lambda (thing) (nth 3 thing)) ...)

to the IMHO, more direct and readable:

    (mapcar #'fourth ...)

I'm adding `rest' to the list as well, as the natural corollary to
`first'.

Which would be used is obviously situational, and should be left to
whoever is touching that code.  There is no general need to "upgrade"
old code to prefer these new functions.

Thoughts?