1
0
Fork 0
cl-sites/HyperSpec-7-0/HyperSpec/Body/s_the.htm
2024-04-01 10:24:07 +02:00

83 lines
6.4 KiB
HTML

<!-- Common Lisp HyperSpec (TM), version 7.0 generated by Kent M. Pitman on Mon, 11-Apr-2005 2:31am EDT -->
<HTML>
<HEAD>
<TITLE>CLHS: Special Operator THE</TITLE>
<LINK HREF="../Data/clhs.css" REL="stylesheet" TYPE="text/css" />
<META HTTP-EQUIV="Author" CONTENT="Kent M. Pitman">
<META HTTP-EQUIV="Organization" CONTENT="LispWorks Ltd.">
<LINK REL=TOP HREF="../Front/index.htm">
<LINK REL=COPYRIGHT HREF="../Front/Help.htm#Legal">
<LINK REL=DISCLAIMER HREF="../Front/Help.htm#Disclaimer">
<LINK REL=PREV HREF="s_locall.htm">
<LINK REL=UP HREF="c_evalua.htm">
<LINK REL=NEXT HREF="f_specia.htm">
</HEAD>
<BODY>
<H1><A REV=MADE HREF="http://www.lispworks.com/"><IMG WIDTH=80 HEIGHT=65 ALT="[LISPWORKS]" SRC="../Graphics/LWSmall.gif" ALIGN=Bottom></A><A REL=TOP HREF="../Front/index.htm"><IMG WIDTH=237 HEIGHT=65 ALT="[Common Lisp HyperSpec (TM)]" SRC="../Graphics/CLHS_Sm.gif" ALIGN=Bottom></A> <A REL=PREV HREF="s_locall.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Previous]" SRC="../Graphics/Prev.gif" ALIGN=Bottom></A><A REL=UP HREF="c_evalua.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Up]" SRC="../Graphics/Up.gif" ALIGN=Bottom></A><A REL=NEXT HREF="f_specia.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Next]" SRC="../Graphics/Next.gif" ALIGN=Bottom></A></H1>
<HR>
<A NAME="the"><I>Special Operator</I> <B>THE</B></A> <P>
<P><B>Syntax:</B><P>
<P>
<B>the</B> <I>value-type form</I> =&gt; <I><I>result</I><B>*</B></I><P>
<P>
<P><B>Arguments and Values:</B><P>
<P>
<I>value-type</I>---a <A REL=DEFINITION HREF="26_glo_t.htm#type_specifier"><I>type specifier</I></A>; not evaluated. <P>
<I>form</I>---a <A REL=DEFINITION HREF="26_glo_f.htm#form"><I>form</I></A>; evaluated. <P>
<I>results</I>---the <A REL=DEFINITION HREF="26_glo_v.htm#value"><I>values</I></A> resulting from the <A REL=DEFINITION HREF="26_glo_e.htm#evaluation"><I>evaluation</I></A> of <I>form</I>. These <A REL=DEFINITION HREF="26_glo_v.htm#value"><I>values</I></A> must conform to the <A REL=DEFINITION HREF="26_glo_t.htm#type"><I>type</I></A> supplied by <I>value-type</I>; see below. <P>
<P><B>Description:</B><P>
<P>
<A REL=DEFINITION HREF="#the"><B>the</B></A> specifies that the <A REL=DEFINITION HREF="26_glo_v.htm#value"><I>values</I></A>[1a] returned by <I>form</I> are of the <A REL=DEFINITION HREF="26_glo_t.htm#type"><I>types</I></A> specified by <I>value-type</I>. The consequences are undefined if any <I>result</I> is not of the declared type. <P>
<P>
It is permissible for <I>form</I> to <A REL=DEFINITION HREF="26_glo_y.htm#yield"><I>yield</I></A> a different number of <A REL=DEFINITION HREF="26_glo_v.htm#value"><I>values</I></A> than are specified by <I>value-type</I>, provided that the values for which <I>types</I> are declared are indeed of those <A REL=DEFINITION HREF="26_glo_t.htm#type"><I>types</I></A>. Missing values are treated as <A REL=DEFINITION HREF="a_nil.htm#nil"><B>nil</B></A> for the purposes of checking their <A REL=DEFINITION HREF="26_glo_t.htm#type"><I>types</I></A>. <P>
Regardless of number of <A REL=DEFINITION HREF="26_glo_v.htm#value"><I>values</I></A> declared by <I>value-type</I>, the number of <A REL=DEFINITION HREF="26_glo_v.htm#value"><I>values</I></A> returned by the <A REL=DEFINITION HREF="#the"><B>the</B></A> <A REL=DEFINITION HREF="26_glo_s.htm#special_form"><I>special form</I></A> is the same as the number of <A REL=DEFINITION HREF="26_glo_v.htm#value"><I>values</I></A> returned by <I>form</I>. <P>
<P><B>Examples:</B><P>
<P>
<PRE>
(the symbol (car (list (gensym)))) =&gt; #:G9876
(the fixnum (+ 5 7)) =&gt; 12
(the (values) (truncate 3.2 2)) =&gt; 1, 1.2
(the integer (truncate 3.2 2)) =&gt; 1, 1.2
(the (values integer) (truncate 3.2 2)) =&gt; 1, 1.2
(the (values integer float) (truncate 3.2 2)) =&gt; 1, 1.2
(the (values integer float symbol) (truncate 3.2 2)) =&gt; 1, 1.2
(the (values integer float symbol t null list)
(truncate 3.2 2)) =&gt; 1, 1.2
(let ((i 100))
(declare (fixnum i))
(the fixnum (1+ i))) =&gt; 101
(let* ((x (list 'a 'b 'c))
(y 5))
(setf (the fixnum (car x)) y)
x) =&gt; (5 B C)
</PRE>
</TT> <P>
<P><B>Affected By:</B> None.
<P>
<P><B>Exceptional Situations:</B><P>
<P>
The consequences are undefined if the <A REL=DEFINITION HREF="26_glo_v.htm#value"><I>values</I></A> <I>yielded</I> by the <I>form</I> are not of the <A REL=DEFINITION HREF="26_glo_t.htm#type"><I>type</I></A> specified by <I>value-type</I>. <P>
<P><B>See Also:</B><P>
<P>
<B>values</B> <P>
<P><B>Notes:</B><P>
<P>
The <B>values</B> <A REL=DEFINITION HREF="26_glo_t.htm#type_specifier"><I>type specifier</I></A> can be used to indicate the types of <A REL=DEFINITION HREF="26_glo_m.htm#multiple_values"><I>multiple values</I></A>: <P>
<PRE>
(the (values integer integer) (floor x y))
(the (values string t)
(gethash the-key the-string-table))
</PRE>
</TT> <P>
<A REL=DEFINITION HREF="m_setf_.htm#setf"><B>setf</B></A> can be used with <A REL=DEFINITION HREF="#the"><B>the</B></A> type declarations. In this case the declaration is transferred to the form that specifies the new value. The resulting <A REL=DEFINITION HREF="m_setf_.htm#setf"><B>setf</B></A> <A REL=DEFINITION HREF="26_glo_f.htm#form"><I>form</I></A> is then analyzed. <P>
<P><HR>The following <A REL=META HREF="../Front/X3J13Iss.htm">X3J13 cleanup issues</A>, <I>not part of the specification</I>, apply to this section:<P><UL><LI> <A REL=CHILD HREF="../Issues/iss203.htm">JUN90-TRIVIAL-ISSUES:27</A><LI> <A REL=CHILD HREF="../Issues/iss346.htm">THE-AMBIGUITY:FOR-DECLARATION</A><LI> <A REL=CHILD HREF="../Issues/iss347.htm">THE-VALUES:RETURN-NUMBER-RECEIVED</A><P></UL><HR>
<A REL=NAVIGATOR HREF="../Front/StartPts.htm"><IMG WIDTH=80 HEIGHT=40 ALT="[Starting Points]" SRC="../Graphics/StartPts.gif" ALIGN=Bottom></A><A REL=TOC HREF="../Front/Contents.htm"><IMG WIDTH=80 HEIGHT=40 ALT="[Contents]" SRC="../Graphics/Contents.gif" ALIGN=Bottom></A><A REL=INDEX HREF="../Front/X_Master.htm"><IMG WIDTH=80 HEIGHT=40 ALT="[Index]" SRC="../Graphics/Index.gif" ALIGN=Bottom></A><A REL=INDEX HREF="../Front/X_Symbol.htm"><IMG WIDTH=80 HEIGHT=40 ALT="[Symbols]" SRC="../Graphics/Symbols.gif" ALIGN=Bottom></A><A REL=GLOSSARY HREF="../Body/26_a.htm"><IMG WIDTH=80 HEIGHT=40 ALT="[Glossary]" SRC="../Graphics/Glossary.gif" ALIGN=Bottom></A><A HREF="../Front/X3J13Iss.htm"><IMG WIDTH=80 HEIGHT=40 ALT="[Issues]" SRC="../Graphics/Issues.gif" ALIGN=Bottom></A><BR>
<A REL=COPYRIGHT HREF="../Front/Help.htm#Legal"><I>Copyright 1996-2005, LispWorks Ltd. All rights reserved.</I></A><P>
</BODY>
</HTML>