Final segment of a list
The following is a theorem.
(implies (and (integerp n) (<= 0 n) (true-listp l)) (equal (length (nthcdr n l)) (if (<= n (length l)) (- (length l) n) 0)))
For related functions, see take and see butlast.
The guard of
Function:
(defun nthcdr (n l) (declare (xargs :guard (and (integerp n) (<= 0 n) (true-listp l)))) (if (zp n) l (nthcdr (+ n -1) (cdr l))))