[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.

Sigh.  Unfortunately, I must beg to differ.  I read the passage on page 194
as requiring only that the fully evaluated arguments be processed
left-to-right for contagion purposes.  This is not the same as requiring
that argument forms in a call be evaluated left-to-right.

-- Guy