1
0
Fork 0
cl-sites/www.cs.cmu.edu/Groups/AI/html/cltl/clm/node22.html

98 lines
5.5 KiB
HTML
Raw Normal View History

2023-10-25 11:23:21 +02:00
<!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>2.2.1. Standard Characters</TITLE>
</HEAD>
<BODY>
<meta name="description" value=" Standard Characters">
<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=tex2html1784 HREF="node23.html"><IMG ALIGN=BOTTOM ALT="next" SRC="icons/next_motif.gif"></A> <A NAME=tex2html1782 HREF="node21.html"><IMG ALIGN=BOTTOM ALT="up" SRC="icons/up_motif.gif"></A> <A NAME=tex2html1776 HREF="node21.html"><IMG ALIGN=BOTTOM ALT="previous" SRC="icons/previous_motif.gif"></A> <A NAME=tex2html1786 HREF="node1.html"><IMG ALIGN=BOTTOM ALT="contents" SRC="icons/contents_motif.gif"></A> <A NAME=tex2html1787 HREF="index.html"><IMG ALIGN=BOTTOM ALT="index" SRC="icons/index_motif.gif"></A> <BR>
<B> Next:</B> <A NAME=tex2html1785 HREF="node23.html"> Line Divisions</A>
<B>Up:</B> <A NAME=tex2html1783 HREF="node21.html"> Characters</A>
<B> Previous:</B> <A NAME=tex2html1777 HREF="node21.html"> Characters</A>
<HR> <P>
<H2><A NAME=SECTION00621000000000000000>2.2.1. Standard Characters</A></H2>
<P>
Common Lisp defines a standard character set (subtype <tt>standard-char</tt>)
for two purposes.
Common Lisp programs that are <i>written</i> in the standard character set
can be read by any Common Lisp implementation; and Common Lisp programs
that <i>use</i> only standard characters as data objects are most likely
to be portable. The Common Lisp character set consists of a space character
<tt>#\Space</tt>, a newline character <tt>#\Newline</tt>, and the
following ninety-four
non-blank printing characters or their equivalents:
<P><pre>
! &quot; # $ % &amp; ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; &lt; = &gt; ?
@ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ \ ] ^ _
` a b c d e f g h i j k l m n o p q r s t u v w x y z { | } ~
</pre><P>
The Common Lisp standard character set is apparently equivalent to
the ninety-five standard ASCII printing characters plus a newline character.
Nevertheless, Common Lisp is designed to be relatively independent of
the ASCII character encoding. For example, the collating sequence
is not specified except to say that digits must be properly ordered,
the uppercase letters must be properly ordered, and
the lowercase letters must be properly ordered
(see <tt>char&lt;</tt> for a precise specification).
Other character encodings, particularly EBCDIC, should be easily accommodated
(with a suitable mapping of printing characters).
<P>
Of the ninety-four non-blank printing characters, the following are
used in only limited ways in the syntax of Common Lisp programs:
<P><pre>
[ ] { } ? ! ^ _ ~ $ %
</pre>
<img align=bottom alt="old_change_begin" src="gif/old_change_begin.gif"><br>
All of these characters except <tt>!</tt> and <tt>_</tt> are used within
<tt>format</tt> strings as formatting directives.
Except for this,
<tt>[</tt>, <tt>]</tt>, <tt>{</tt>, <tt>}</tt>,
<tt>?</tt>, and <tt>!</tt> are not used in Common Lisp and are reserved to the user
for syntactic extensions; <tt>^</tt> and <tt>_</tt>
are not yet used in Common Lisp
but are part of the syntax of reserved tokens
and are reserved to implementors;
<tt>~</tt> is not yet used in Common Lisp and is reserved to implementors;
and <tt>$</tt> and <tt>%</tt> are normally regarded as alphabetic characters
but are not used in the names of any standard Common Lisp functions,
variables, or other entities.
<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 June 1989 (PRETTY-PRINT-INTERFACE) <A NAME=928>&#160;</A>
to add a <tt>format</tt> directive <tt>~_</tt> (see chapter <A HREF="node253.html#PPRINT">27</A>).
<br><img align=bottom alt="change_end" src="gif/change_end.gif">
<P>
The following characters are called <i>semi-standard</i>:
<P><pre>
#\Backspace #\Tab #\Linefeed #\Page #\Return #\Rubout
</pre><P>
Not all implementations of Common Lisp need to support them; but those
implementations that
use the standard ASCII character set should support them, treating them as
corresponding respectively to the ASCII characters BS (octal code 010),
HT (011), LF (012), FF (014), CR (015), and DEL
(177). These characters are not
members of the subtype <tt>standard-char</tt> unless synonymous with
one of the standard characters specified above.
For example, in a given implementation it might
be sensible for the implementor to define
<tt>#\Linefeed</tt> or <tt>#\Return</tt> to be synonymous with <tt>#\Newline</tt>,
or <tt>#\Tab</tt> to be synonymous with <tt>#\Space</tt>.
<P>
<BR> <HR><A NAME=tex2html1784 HREF="node23.html"><IMG ALIGN=BOTTOM ALT="next" SRC="icons/next_motif.gif"></A> <A NAME=tex2html1782 HREF="node21.html"><IMG ALIGN=BOTTOM ALT="up" SRC="icons/up_motif.gif"></A> <A NAME=tex2html1776 HREF="node21.html"><IMG ALIGN=BOTTOM ALT="previous" SRC="icons/previous_motif.gif"></A> <A NAME=tex2html1786 HREF="node1.html"><IMG ALIGN=BOTTOM ALT="contents" SRC="icons/contents_motif.gif"></A> <A NAME=tex2html1787 HREF="index.html"><IMG ALIGN=BOTTOM ALT="index" SRC="icons/index_motif.gif"></A> <BR>
<B> Next:</B> <A NAME=tex2html1785 HREF="node23.html"> Line Divisions</A>
<B>Up:</B> <A NAME=tex2html1783 HREF="node21.html"> Characters</A>
<B> Previous:</B> <A NAME=tex2html1777 HREF="node21.html"> Characters</A>
<HR> <P>
<HR>
<P><ADDRESS>
AI.Repository@cs.cmu.edu
</ADDRESS>
</BODY>