Mercurial > emacs
diff lisp/subr.el @ 19492:892a09772457
(last): New function.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Sat, 23 Aug 1997 19:10:42 +0000 |
parents | f5fd22f3462c |
children | 17db1ee36bbb |
line wrap: on
line diff
--- a/lisp/subr.el Sat Aug 23 18:55:52 1997 +0000 +++ b/lisp/subr.el Sat Aug 23 19:10:42 1997 +0000 @@ -78,6 +78,13 @@ (defsubst cddr (x) "Return the cdr of the cdr of X." (cdr (cdr x))) + +(defun last (x) + "Return the last element of the list X. +If X is nil, return nil." + (while (cdr x) + (setq x (cdr x))) + x) ;;;; Keymap support.