Function: backquote-list*-function

backquote-list*-function is a byte-compiled function defined in backquote.el.gz.

Signature

(backquote-list*-function 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
;; function and macro versions of backquote-list*

(defun backquote-list*-function (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 (cons first (apply 'backquote-list*-function list)) first))
  ;; but Emacs is not very good at efficiently processing recursion.
  (if list
      (let* ((rest list) (newlist (cons first nil)) (last newlist))
	(while (cdr rest)
	  (setcdr last (cons (car rest) nil))
	  (setq last (cdr last)
		rest (cdr rest)))
	(setcdr last (car rest))
	newlist)
    first))