Function: backquote-list*-macro

backquote-list*-macro is a macro defined in backquote.el.gz.

Signature

(backquote-list*-macro FIRST &rest LIST)

Documentation

Like list but the last argument is the tail of the new list.

For example (backquote-list* 'a 'b 'c) => (a b . c)

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/backquote.el.gz
(defmacro backquote-list*-macro (first &rest list)
  "Like `list' but the last argument is the tail of the new list.

For example (backquote-list* \\='a \\='b \\='c) => (a b . c)"
  ;; The recursive solution is much nicer:
  ;; (if list (list 'cons first (cons 'backquote-list*-macro list)) first))
  ;; but Emacs is not very good at efficiently processing such things.
  (setq list (nreverse (cons first list))
	first (car list)
	list (cdr list))
  (if list
      (let* ((second (car list))
	     (rest (cdr list))
	     (newlist (list 'cons second first)))
	(while rest
	  (setq newlist (list 'cons (car rest) newlist)
		rest (cdr rest)))
	newlist)
    first))