comparison lisp/subr.el @ 45823:7ec7fff5e571

(pop): Move the call to `car' outside the prog1, as the compiler generate better code for it.
author Miles Bader <miles@gnu.org>
date Fri, 14 Jun 2002 06:15:00 +0000
parents 41129d3d126b
children a8fbafaa31ad
comparison
equal deleted inserted replaced
45822:5d2e84e46c56 45823:7ec7fff5e571
87 (defmacro pop (listname) 87 (defmacro pop (listname)
88 "Return the first element of LISTNAME's value, and remove it from the list. 88 "Return the first element of LISTNAME's value, and remove it from the list.
89 LISTNAME must be a symbol whose value is a list. 89 LISTNAME must be a symbol whose value is a list.
90 If the value is nil, `pop' returns nil but does not actually 90 If the value is nil, `pop' returns nil but does not actually
91 change the list." 91 change the list."
92 (list 'prog1 (list 'car listname) 92 (list 'car
93 (list 'setq listname (list 'cdr listname)))) 93 (list 'prog1 listname
94 (list 'setq listname (list 'cdr listname)))))
94 95
95 (defmacro when (cond &rest body) 96 (defmacro when (cond &rest body)
96 "If COND yields non-nil, do BODY, else return nil." 97 "If COND yields non-nil, do BODY, else return nil."
97 (list 'if cond (cons 'progn body))) 98 (list 'if cond (cons 'progn body)))
98 99