



Today this functionality seems a little awkward since we learn to either expect the program to return in the last statement, or to instruct it explicitly what to return. In other words, progn will return the result of the last statement it contains, whereas prog1 will return the first, and similar for prog2. The n or 1 or 2 part of the name stands for the statement from the list whose result you are interested in. most often inside an unwind-protect, and, or, or in the then-part of an if.Ī better way to understand what progn is is by comparing it to the family: prog1 and prog2. At best it may equal but never magically boost performance. The built-in control structures are special forms since their subforms are not necessarily evaluated or not evaluated sequentially. Here's an excerpt (emphasis added) from the lisp reference manual: This behavior goes back to the fundamentals of lisp control structures and functional programming. Helps to not confuse execution with parsing. progn enforces execution sequence the same as textual sequence. Without progn, sequence is not guaranteed, especially if subsequent expressions are dependent on the side effects or return values of the previous expressions. Progn is a special form that causes each of its arguments to be evaluated in sequence and then returns the value of the last one. The most important reason for progn is described in the first line of the progn documentation (emphasis added):
