Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emacs
emacs
Commits
f9efebca
Commit
f9efebca
authored
Aug 27, 1997
by
Richard M. Stallman
Browse files
(last*): Definition deleted.
parent
369fba5f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
10 deletions
+10
-10
lisp/emacs-lisp/cl.el
lisp/emacs-lisp/cl.el
+10
-10
No files found.
lisp/emacs-lisp/cl.el
View file @
f9efebca
...
...
@@ -499,16 +499,16 @@ SEQ, this is like `mapcar'. With several, it is like the Common Lisp
"Return the `cdr' of the `cdr' of the `cdr' of the `cdr' of X."
(
cdr
(
cdr
(
cdr
(
cdr
x
)))))
(
defun
last*
(
x
&optional
n
)
"Returns the last link in the list LIST.
With optional argument N, returns Nth-to-last link (default 1)."
(
if
n
(
let
((
m
0
)
(
p
x
))
(
while
(
consp
p
)
(
incf
m
)
(
pop
p
))
(
if
(
<=
n
0
)
p
(
if
(
<
n
m
)
(
nthcdr
(
-
m
n
)
x
)
x
)))
(
while
(
consp
(
cdr
x
))
(
pop
x
))
x
))
;;
(defun last* (x &optional n)
;;
"Returns the last link in the list LIST.
;;
With optional argument N, returns Nth-to-last link (default 1)."
;;
(if n
;;
(let ((m 0) (p x))
;;
(while (consp p) (incf m) (pop p))
;;
(if (<= n 0) p
;;
(if (< n m) (nthcdr (- m n) x) x)))
;;
(while (consp (cdr x)) (pop x))
;;
x))
(
defun
butlast
(
x
&optional
n
)
"Returns a copy of LIST with the last N elements removed."
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment