Debian Codegraph @

docsrc/xlisp/xlisp-doc/examples/common-lisp/debug-mv.htm

raw
1 <html><head>
2
3 <title>cl:debug:mv</title>
4
5 <style type="text/css">
6 .example {
7 color: #000000;
8 background-color: #F5F5F5;
9 padding: 8px;
10 border: #808080;
11 border-style: solid;
12 border-width: 1px;
13 width:auto;
14 }
15 .button {
16 color: #000000;
17 background-color: #F5F5F5;
18 padding-top: 1px;
19 padding-bottom: 1px;
20 padding-left: 4px;
21 padding-right: 8px;
22 border: #808080;
23 border-style: solid;
24 border-width: 1px;
25 white-space: pre;
26 }
27 .box {
28 color: #000000;
29 padding-top: 4px;
30 padding-bottom: 4px;
31 padding-left: 16px;
32 padding-right: 16px;
33 border: #808080;
34 border-style: solid;
35 border-width: 1px;
36 }
37 </style>
38
39 </head>
40
41 <body>
42
43 <a href="../../start.htm">Nyquist / XLISP 2.0</a>&nbsp; -&nbsp;
44 <a href="../../manual/contents.htm">Contents</a> |
45 <a href="../../tutorials/tutorials.htm">Tutorials</a> |
46 <a href="../examples.htm">Examples</a> |
47 <a href="../../reference/reference-index.htm">Reference</a>
48
49 <hr>
50
51 <h1>cl:debug:mv</h1>
52
53 <hr>
54
55 <p>The <nobr>cl:<b>debug:mv</b></b></nobr> function can be used to debug
56 multiple value expressions:</p>
57
58 <p><div class="box">
59
60 <dl>
61 <dt>(cl:<b>debug:mv</b> <i>expr</i></dt>
62 <dd><i>expr</i> - a Lisp expression, returning an arbitrary number of values<br>
63 returns - the normal Lisp return value from evaluating <i>expr</i></dd>
64 </dl>
65
66 </div></p>
67
68 <pre class="example">
69 (defun <font color="#0000CC">cl:debug:mv</font> (expr)
70 (setq <font color="#AA5500">cl:*multiple-values*</font> nil)
71 (let ((result (eval expr)))
72 (format t <font color="#880000">";; cl:*multiple-values* =&gt; ~a~%"</font> <font color="#AA5500">cl:*multiple-values*</font>)
73 (format t <font color="#880000">";; *rslt* =&gt; ~a~a~%"</font> <font color="#AA5500">*rslt*</font>
74 (if <font color="#AA5500">cl:*multiple-values*</font> <font color="#880000">"" " [invalid]"</font>))
75 result))
76 </pre>
77
78 <p>The <nobr>cl:<b>debug:mv</b></nobr> function first sets the
79 <nobr><a href="global-multiple-values.htm">cl:*multiple-values*</a></nobr>
80 variable <nobr>to <a href="../../reference/nil.htm">NIL</a></nobr>, then it
81 evaluates the expression. After evaluation it prints the values of the
82 <nobr><a href="global-multiple-values.htm">cl:*multiple-values*</a></nobr>
83 and <a href="../../reference/global-rslt.htm">*rslt*</a> variables and
84 returns the normal Lisp return value from the evaluation.</p>
85
86 <p>Example:</p>
87
88 <pre class="example">
89 &gt; (cl:debug:mv '(cl:values 1 2 3))
90 ;; cl:*multiple-values* =&gt; T
91 ;; *rslt* =&gt; (1 2 3)
92 1
93
94 &gt; (cl:debug:mv 1)
95 ;; cl:*multiple-values* =&gt; NIL
96 ;; *rslt* =&gt; (1 2 3) [invalid]
97 1
98 </pre>
99
100 <p><nobr>&nbsp;&nbsp;<a href="#top">Back to top</a></nobr></p>
101
102 <hr>
103
104 <a href="../../start.htm">Nyquist / XLISP 2.0</a>&nbsp; -&nbsp;
105 <a href="../../manual/contents.htm">Contents</a> |
106 <a href="../../tutorials/tutorials.htm">Tutorials</a> |
107 <a href="../examples.htm">Examples</a> |
108 <a href="../../reference/reference-index.htm">Reference</a>
109
110 </body></html>