[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

PROG1 as a function



    Date: Tue, 3 Jan 89 20:10 EST
    From: Barry Margolin <barmar@Think.COM>

    One of our users noticed today that Symbolics defines PROG1 as a
    function, rather than as a macro as CLtL specifies.  The definition is
    essentially

	    (defun prog1 (first-form &rest rest-forms)
	      (declare (ignore rest-forms))
	      first-form)

    This works because CL requires left-to-right evaluation of function
    arguments

CLtL is vague about the order of evaluation of function arguments.  In
chapters 5 and 7 it neither says that the order is left-to-right nor
that the order is undefined, and I suspect that the person who made
PROG1 a macro thought the order was undefined; I can't see any other
reason that it would need to be a macro.  The place in CLtL that says
that all function arguments are evaluated left-to-right is page 194,
buried in the middle of a discussion on numeric contagion.