From f3ef1a282d0aa1f4c2a21c946845516d0caf8c31 Mon Sep 17 00:00:00 2001 From: Matus Goljer Date: Tue, 14 Mar 2023 13:46:10 +0100 Subject: [PATCH] seq.el: add seq-last for symmetry with seq-first --- lisp/emacs-lisp/seq.el | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lisp/emacs-lisp/seq.el b/lisp/emacs-lisp/seq.el index 6917c541f2e..2571b558c95 100644 --- a/lisp/emacs-lisp/seq.el +++ b/lisp/emacs-lisp/seq.el @@ -124,6 +124,10 @@ name to be bound to the rest of SEQUENCE." "Return the first element of SEQUENCE." (seq-elt sequence 0)) +(defun seq-last (sequence) + "Return the last element of SEQUENCE." + (seq-elt sequence (1- (seq-length sequence)))) + (defun seq-rest (sequence) "Return SEQUENCE with its first element removed." (seq-drop sequence 1)) -- 2.34.1