We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3e25e57 commit e5f472bCopy full SHA for e5f472b
lisp/l/common.l
@@ -448,9 +448,10 @@ if pos is bigger than the length of list, item is nconc'ed at the tail"
448
(nconc result1 result2)))
449
450
(defun rotate-list (l) (append (cdr l) (list (car l))))
451
-(defun last (x)
452
- (while (consp (cdr x)) (setq x (cdr x)))
453
- x)
+(defun last (x &optional (n 1))
+ (unless (integerp n)
+ (error "last &optional n must be integer"))
454
+ (nthcdr (max (- (length x) n) 0) x))
455
(defun copy-tree (x) (subst t t x))
456
(defun copy-list (x) (nreverse (reverse x)))
457
(defun nreconc (x y) (nconc (nreverse x) y))
0 commit comments