Debian Codegraph @

docsrc/xlisp/xlisp-doc/examples/common-lisp/values-list.htm

raw
1 <html><head>
2
3 <title>cl:values-list</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:values-list</h1>
52
53 <hr>
54
55 <p>The <nobr>cl:<b>values-list</b></nobr> function returns the elements of a
56 list unevaluated as multiple values:</p>
57
58 <p><div class="box">
59
60 <dl>
61 <dt>(cl:<b>values-list</b> <i>list</i>)</dt>
62 <dd><i>list</i> - a list of values<br>
63 returns - the elements of the list as multiple values</dd>
64 </dl>
65
66 </div></p>
67
68 <pre class="example">
69 (defun <font color="#0000CC">cl:values-list</font> (list)
70 (or (listp list) (error <font color="#880000">"not a list"</font> list))
71 (or (null list) (consp (last list)) (error <font color="#880000">"not a proper list"</font> list))
72 (setq <font color="#AA5500">*rslt*</font> list
73 <font color="#AA5500">cl:*multiple-values*</font> t)
74 (first list))
75 </pre>
76
77 <p>The unevaluated first value from the list is returned as the primary
78 return value, and the list is assigned to the Nyquist
79 <a href="../../reference/global-rslt.htm">*rslt*</a> variable. <nobr>If
80 an</nobr> an empty list is given, <a href="../../reference/nil.htm">NIL</a>
81 is returned and the <a href="../../reference/global-rslt.htm">*rslt*</a>
82 variable is set <nobr>to <a href="../../reference/nil.htm">NIL</a></nobr>.
83 <nobr>An error</nobr> is signalled if the 'list' argument is not a list or
84 if the list does not end
85 <nobr>with <a href="../../reference/nil.htm">NIL</a></nobr>.</p>
86
87 <p><nobr>The
88 <a href="global-multiple-values.htm">cl:*multiple-values*</a></nobr>
89 variable is set <nobr>to
90 <a href="../../reference/t.htm">&nbsp;T&nbsp;</a></nobr> to indicate that
91 multiple values are returned.</p>
92
93 <p>Examples:</p>
94
95 <pre class="example">
96 (cl:values-list nil) =&gt; NIL <font color="#008844">; *rslt* = NIL</font>
97 (cl:values-list '(1)) =&gt; 1 <font color="#008844">; *rslt* = (1)</font>
98 (cl:values-list '(1 2)) =&gt; 1 <font color="#008844">; *rslt* = (1 2)</font>
99 (cl:values-list '(1 2 3)) =&gt; 1 <font color="#008844">; *rslt* = (1 2 3)</font>
100 (cl:values-list '(1 2 . 3)) =&gt; <font color="#AA0000">error: not a proper list - (1 2 . 3)</font>
101 </pre>
102
103 <p><nobr>&nbsp;&nbsp;<a href="#top">Back to top</a></nobr></p>
104
105 <hr>
106
107 <a href="../../start.htm">Nyquist / XLISP 2.0</a>&nbsp; -&nbsp;
108 <a href="../../manual/contents.htm">Contents</a> |
109 <a href="../../tutorials/tutorials.htm">Tutorials</a> |
110 <a href="../examples.htm">Examples</a> |
111 <a href="../../reference/reference-index.htm">Reference</a>
112
113 </body></html>