54 lines
2.8 KiB
HTML
54 lines
2.8 KiB
HTML
|
<!DOCTYPE HTML PUBLIC "-//W3O//DTD W3 HTML 2.0//EN">
|
||
|
<!Converted with LaTeX2HTML 0.6.5 (Tue Nov 15 1994) by Nikos Drakos (nikos@cbl.leeds.ac.uk), CBLU, University of Leeds >
|
||
|
<HEAD>
|
||
|
<TITLE>4.3. Predicating Type Specifiers</TITLE>
|
||
|
</HEAD>
|
||
|
<BODY>
|
||
|
<meta name="description" value=" Predicating Type Specifiers">
|
||
|
<meta name="keywords" value="clm">
|
||
|
<meta name="resource-type" value="document">
|
||
|
<meta name="distribution" value="global">
|
||
|
<P>
|
||
|
<b>Common Lisp the Language, 2nd Edition</b>
|
||
|
<BR> <HR><A NAME=tex2html2091 HREF="node48.html"><IMG ALIGN=BOTTOM ALT="next" SRC="icons/next_motif.gif"></A> <A NAME=tex2html2089 HREF="node44.html"><IMG ALIGN=BOTTOM ALT="up" SRC="icons/up_motif.gif"></A> <A NAME=tex2html2083 HREF="node46.html"><IMG ALIGN=BOTTOM ALT="previous" SRC="icons/previous_motif.gif"></A> <A NAME=tex2html2093 HREF="node1.html"><IMG ALIGN=BOTTOM ALT="contents" SRC="icons/contents_motif.gif"></A> <A NAME=tex2html2094 HREF="index.html"><IMG ALIGN=BOTTOM ALT="index" SRC="icons/index_motif.gif"></A> <BR>
|
||
|
<B> Next:</B> <A NAME=tex2html2092 HREF="node48.html"> Type Specifiers That </A>
|
||
|
<B>Up:</B> <A NAME=tex2html2090 HREF="node44.html"> Type Specifiers</A>
|
||
|
<B> Previous:</B> <A NAME=tex2html2084 HREF="node46.html"> Type Specifier Lists</A>
|
||
|
<HR> <P>
|
||
|
<H1><A NAME=SECTION00830000000000000000>4.3. Predicating Type Specifiers</A></H1>
|
||
|
<P>
|
||
|
<A NAME=PREDICATINGTYPESPECIFIERSSECTION>A</A>
|
||
|
type specifier list <tt>(satisfies <i>predicate-name</i>)</tt> denotes
|
||
|
the set of all objects that satisfy the predicate named by <i>predicate-name</i>,
|
||
|
which must be a symbol whose global function definition is a one-argument
|
||
|
predicate.
|
||
|
(A name is required; lambda-expressions are disallowed in order to avoid
|
||
|
scoping problems.) For example, the type <tt>(satisfies numberp)</tt> is the
|
||
|
same as the type <tt>number</tt>.
|
||
|
The call <tt>(typep x '(satisfies p))</tt> results in applying <tt>p</tt> to <tt>x</tt>
|
||
|
and returning <tt>t</tt> if the result is true and <tt>nil</tt> if the result is false.
|
||
|
<P>
|
||
|
<img align=bottom alt="old_change_begin" src="gif/old_change_begin.gif"><br>
|
||
|
As an example, the type <tt>string-char</tt> could be defined as
|
||
|
<P><pre>
|
||
|
(deftype string-char ()
|
||
|
'(and character (satisfies string-char-p)))
|
||
|
</pre><P>
|
||
|
See <tt>deftype</tt>.
|
||
|
<br><img align=bottom alt="old_change_end" src="gif/old_change_end.gif">
|
||
|
<P>
|
||
|
<img align=bottom alt="change_begin" src="gif/change_begin.gif"><br>
|
||
|
X3J13 voted in March 1989 (COMMON-TYPE) <A NAME=2151> </A> to remove the type <tt>string-char</tt>
|
||
|
and the function <tt>string-char-p</tt> from the language.
|
||
|
<br><img align=bottom alt="change_end" src="gif/change_end.gif">
|
||
|
<P>
|
||
|
It is not a good idea for
|
||
|
a predicate appearing in a <tt>satisfies</tt> type specifier to
|
||
|
cause any side effects when invoked.
|
||
|
<P>
|
||
|
<HR>
|
||
|
<P><ADDRESS>
|
||
|
AI.Repository@cs.cmu.edu
|
||
|
</ADDRESS>
|
||
|
</BODY>
|