| 1 |
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> |
| 2 |
<html> |
| 3 |
<!-- Created by GNU Texinfo 6.7, http://www.gnu.org/software/texinfo/ --> |
| 4 |
<head> |
| 5 |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
| 6 |
<title>progv (ANSI and GNU Common Lisp Document)</title> |
| 7 |
|
| 8 |
<meta name="description" content="progv (ANSI and GNU Common Lisp Document)"> |
| 9 |
<meta name="keywords" content="progv (ANSI and GNU Common Lisp Document)"> |
| 10 |
<meta name="resource-type" content="document"> |
| 11 |
<meta name="distribution" content="global"> |
| 12 |
<meta name="Generator" content="makeinfo"> |
| 13 |
<link href="index.html" rel="start" title="Top"> |
| 14 |
<link href="Data-and-Control-Flow-Dictionary.html" rel="up" title="Data and Control Flow Dictionary"> |
| 15 |
<link href="setq.html" rel="next" title="setq"> |
| 16 |
<link href="let.html" rel="prev" title="let"> |
| 17 |
<style type="text/css"> |
| 18 |
<!-- |
| 19 |
a.summary-letter {text-decoration: none} |
| 20 |
blockquote.indentedblock {margin-right: 0em} |
| 21 |
div.display {margin-left: 3.2em} |
| 22 |
div.example {margin-left: 3.2em} |
| 23 |
div.lisp {margin-left: 3.2em} |
| 24 |
kbd {font-style: oblique} |
| 25 |
pre.display {font-family: inherit} |
| 26 |
pre.format {font-family: inherit} |
| 27 |
pre.menu-comment {font-family: serif} |
| 28 |
pre.menu-preformatted {font-family: serif} |
| 29 |
span.nolinebreak {white-space: nowrap} |
| 30 |
span.roman {font-family: initial; font-weight: normal} |
| 31 |
span.sansserif {font-family: sans-serif; font-weight: normal} |
| 32 |
ul.no-bullet {list-style: none} |
| 33 |
--> |
| 34 |
</style> |
| 35 |
|
| 36 |
|
| 37 |
</head> |
| 38 |
|
| 39 |
<body lang="en"> |
| 40 |
<span id="progv"></span><div class="header"> |
| 41 |
<p> |
| 42 |
Next: <a href="setq.html" accesskey="n" rel="next">setq</a>, Previous: <a href="let.html" accesskey="p" rel="prev">let</a>, Up: <a href="Data-and-Control-Flow-Dictionary.html" accesskey="u" rel="up">Data and Control Flow Dictionary</a> </p> |
| 43 |
</div> |
| 44 |
<hr> |
| 45 |
<span id="progv-_005bSpecial-Operator_005d"></span><h4 class="subsection">5.3.19 progv [Special Operator]</h4> |
| 46 |
|
| 47 |
<p><code>progv</code> <i><i>symbols</i> <i>values</i> {<i>form</i>}*</i> ⇒ <i>{<i>result</i>}*</i> |
| 48 |
</p> |
| 49 |
<span id="Arguments-and-Values_003a_003a-40"></span><h4 class="subsubheading">Arguments and Values::</h4> |
| 50 |
|
| 51 |
<p><i>symbols</i>—a <i>list</i> of <i>symbols</i>; evaluated. |
| 52 |
</p> |
| 53 |
<p><i>values</i>—a <i>list</i> of <i>objects</i>; evaluated. |
| 54 |
</p> |
| 55 |
<p><i>forms</i>—an <i>implicit progn</i>. |
| 56 |
</p> |
| 57 |
<p><i>results</i>—the <i>values</i> returned by the <i>forms</i>. |
| 58 |
</p> |
| 59 |
<span id="Description_003a_003a-72"></span><h4 class="subsubheading">Description::</h4> |
| 60 |
|
| 61 |
<p><b>progv</b> creates new dynamic variable <i>bindings</i> and |
| 62 |
executes each <i>form</i> using those <i>bindings</i>. |
| 63 |
Each <i>form</i> is evaluated in order. |
| 64 |
</p> |
| 65 |
<p><b>progv</b> allows <i>binding</i> one or more dynamic |
| 66 |
variables whose names may be determined at run time. |
| 67 |
Each <i>form</i> is evaluated in order |
| 68 |
with the dynamic variables whose names are in |
| 69 |
<i>symbols</i> bound to corresponding <i>values</i>. |
| 70 |
If too few <i>values</i> |
| 71 |
are supplied, the remaining <i>symbols</i> are bound and then |
| 72 |
made to have no value. If too many <i>values</i> are |
| 73 |
supplied, the excess values are ignored. |
| 74 |
The <i>bindings</i> of the dynamic variables are undone on |
| 75 |
exit from <b>progv</b>. |
| 76 |
</p> |
| 77 |
<span id="Examples_003a_003a-46"></span><h4 class="subsubheading">Examples::</h4> |
| 78 |
<div class="example"> |
| 79 |
<pre class="example"> (setq *x* 1) ⇒ 1 |
| 80 |
(progv '(*x*) '(2) *x*) ⇒ 2 |
| 81 |
*x* ⇒ 1 |
| 82 |
|
| 83 |
Assuming *x* is not globally special, |
| 84 |
|
| 85 |
(let ((*x* 3)) |
| 86 |
(progv '(*x*) '(4) |
| 87 |
(list *x* (symbol-value '*x*)))) ⇒ (3 4) |
| 88 |
</pre></div> |
| 89 |
|
| 90 |
<span id="See-Also_003a_003a-57"></span><h4 class="subsubheading">See Also::</h4> |
| 91 |
|
| 92 |
<p><a href="let.html">let</a> |
| 93 |
, <a href="Evaluation.html">Evaluation</a> |
| 94 |
</p> |
| 95 |
<span id="Notes_003a_003a-35"></span><h4 class="subsubheading">Notes::</h4> |
| 96 |
|
| 97 |
<p>Among other things, <b>progv</b> is useful when writing |
| 98 |
interpreters for languages embedded in <span class="roman">Lisp</span>; it provides a handle |
| 99 |
on the mechanism for <i>binding</i> <i>dynamic variables</i>. |
| 100 |
</p> |
| 101 |
|
| 102 |
|
| 103 |
|
| 104 |
</body> |
| 105 |
</html> |