XLISP >
XLISP 2.0 -
Contents -
Reference -
Previous |
Next
progv
Type: |
- |
special form (fsubr) |
Source: |
- |
xlcont.c |
Syntax
- (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
returns - the value of the last expression
Description
The 'progv' special form is basically a 'block' construct 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 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 value of the
last 'expr' will be returned as the result of 'progv'. If there are no
'exprs', NIL is returned.
Examples
(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.
See the
progv
special form in the XLISP 2.0 manual.
Back to Top
XLISP >
XLISP 2.0 -
Contents -
Reference -
Previous |
Next