aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2004-03-22 15:17:01 +0000
committerStefan Monnier2004-03-22 15:17:01 +0000
commit1de9630d9ba42a033a42a2466924ea98d9ba75b4 (patch)
treeb25f7a650b778a56b299fda4abd239629f7c8a05
parent35abd1e238ff1dfa240af85e6cd2bb615945d1be (diff)
downloademacs-1de9630d9ba42a033a42a2466924ea98d9ba75b4.tar.gz
emacs-1de9630d9ba42a033a42a2466924ea98d9ba75b4.zip
(backquote-list*-macro): Use nreverse.
-rw-r--r--lisp/emacs-lisp/backquote.el10
1 files changed, 8 insertions, 2 deletions
diff --git a/lisp/emacs-lisp/backquote.el b/lisp/emacs-lisp/backquote.el
index 81e1a91f76c..6a2baeb3fe9 100644
--- a/lisp/emacs-lisp/backquote.el
+++ b/lisp/emacs-lisp/backquote.el
@@ -1,6 +1,6 @@
1;;; backquote.el --- implement the ` Lisp construct 1;;; backquote.el --- implement the ` Lisp construct
2 2
3;;; Copyright (C) 1990, 1992, 1994, 2001 Free Software Foundation, Inc. 3;; Copyright (C) 1990, 92, 1994, 2001, 2004 Free Software Foundation, Inc.
4 4
5;; Author: Rick Sladkey <jrs@world.std.com> 5;; Author: Rick Sladkey <jrs@world.std.com>
6;; Maintainer: FSF 6;; Maintainer: FSF
@@ -44,6 +44,9 @@
44 "Like `list' but the last argument is the tail of the new list. 44 "Like `list' but the last argument is the tail of the new list.
45 45
46For example (backquote-list* 'a 'b 'c) => (a b . c)" 46For example (backquote-list* 'a 'b 'c) => (a b . c)"
47 ;; The recursive solution is much nicer:
48 ;; (if list (cons first (apply 'backquote-list*-function list)) first))
49 ;; but Emacs is not very good at efficiently processing recursion.
47 (if list 50 (if list
48 (let* ((rest list) (newlist (cons first nil)) (last newlist)) 51 (let* ((rest list) (newlist (cons first nil)) (last newlist))
49 (while (cdr rest) 52 (while (cdr rest)
@@ -58,7 +61,10 @@ For example (backquote-list* 'a 'b 'c) => (a b . c)"
58 "Like `list' but the last argument is the tail of the new list. 61 "Like `list' but the last argument is the tail of the new list.
59 62
60For example (backquote-list* 'a 'b 'c) => (a b . c)" 63For example (backquote-list* 'a 'b 'c) => (a b . c)"
61 (setq list (reverse (cons first list)) 64 ;; The recursive solution is much nicer:
65 ;; (if list (list 'cons first (cons 'backquote-list*-macro list)) first))
66 ;; but Emacs is not very good at efficiently processing such things.
67 (setq list (nreverse (cons first list))
62 first (car list) 68 first (car list)
63 list (cdr list)) 69 list (cdr list))
64 (if list 70 (if list