Structural Informatics Group (SIG) logo
Home | Projects | Demos | Downloads | Publications | Local Info | About Us | New site
Go to the first, previous, next, last section, table of contents.



type: special form (fsubr)
location: built-in
source file: xlcont.c
Common LISP compatible: yes
supported on: all machines


(progv  <symbols> <values> [ <expr1>  <expr2> ... ]  )
        <symbols>       -       a list comprising symbols to be bound
        <values>        -       a list comprising values to be bound to symbols
        <exprN>         -       expressions comprising the body of the loop


The PROGV special form is basically a 'block' construct (like a PASCAL BEGIN / END) that contains a block of code (expressions) to evaluate. PROGV is different from PROG1, PROG2 and PROGN in that it contains a pair of lists - <symbols> and <values>. Before evaluating the <exprN> expressions, PROGV will dynamically bind the <values> to the corresponding <symbols>. If there are too many <symbols> for the <values>, the <symbols> with no corresponding <values> will be bound to NIL. The variables will be unbound after the execution of PROGV. The last <expr>'s value will be returned as the result of PROGV. If there are no <expr>s, NIL is returned.


(progv '(var) '(2)                      ; 
        (print var) (print "two"))      ; prints 2 "two" returns "two"
(setq a "beginning")                    ; initialize A
(progv '(a) '(during) (print a))        ; prints DURING
(print a)                               ; prints "beginning"
(progv '(no-way) '(no-how) )            ; returns NIL
(progv)                                 ; error: too few arguments

NOTE: PROGV is different from PROG (which allows symbols and initialization forms) in that PROGV allows its <symbols> and <values> to be evaluated. This allows you to pass in forms that generate the <symbols> and their <values>.

NOTE: PROG1, PROG2, PROGN and PROGV do not allow the use of RETURN or GO or tags for GO.

Go to the first, previous, next, last section, table of contents.