Each of the special forms in this section simply evaluates its argument forms in left-to-right order. The only difference is the result they return.
The most widely used sequencing special form is progn: it
evaluates all its argument forms and returns the computed value of the last
one. Many other control structures are said to perform an implicit progn,
this means that they call progn with a list of forms.
progn in Lisp is nearly analogous to a begin...end block
in Pascal; it is used in much the same places -- to allow you to
evaluate a sequence of form where only one form was allowed (for example
the true clause of an if structure).
progn it returns nil.
(progn 'one (+ 1 1) "three")
=> "three"
(progn)
=> nil
(prog1 'one (+ 1 1) "three")
=> one
prog1 except that the evaluated value of
its second form is returned.
The first form is evaluated, then its second, then it performs an implicit progn on the remaining arguments.
(prog2 'one (+ 1 1) "three")
=> 2
Go to the first, previous, next, last section, table of contents.