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

PROG1 as a function



    Date: Wed, 4 Jan 89 13:49 EST
    From: David A. Moon <Moon@STONY-BROOK.SCRC.Symbolics.COM>

	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.

Actually, CLtL pg 61 says that the arguments and parameters are
processed in order, from left to right.  I don't know if "processed"
implies "evaluated", but I always assumed (perhaps incorrectly) it did.