-
Notifications
You must be signed in to change notification settings - Fork 0
/
chap-13.texi
1709 lines (1182 loc) · 49.7 KB
/
chap-13.texi
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
@node Characters
@chapter Characters
@menu
* Character Concepts::
* Characters Dictionary::
@end menu
@node Character Concepts
@section Character Concepts
@menu
* Introduction to Characters::
* Introduction to Scripts and Repertoires::
* Character Attributes::
* Character Categories::
* Identity of Characters::
* Ordering of Characters::
* Character Names::
* Treatment of Newline during Input and Output::
* Character Encodings::
* Documentation of Implementation-Defined Scripts::
@end menu
@node Introduction to Characters
@subsection Introduction to Characters
A @newterm{character} is an @term{object} that represents a unitary token
(@eg{} a letter, a special symbol, or a ``control character'')
in an aggregate quantity of text
(@eg{} a @term{string} or a text @term{stream}).
@clisp{}@spc{}allows an implementation to provide support
for international language @term{characters} as well
as @term{characters} used in specialized arenas (@eg{} mathematics).
The following figures contain lists of @term{defined names} applicable to
@term{characters}.
@Thenextfigure{}@spc{}lists some @term{defined names} relating to
@term{character} @term{attributes} and @term{character} @term{predicates}.
@float Figure,fig13.1
@cartouche
@multitable{char-code-limit}{char-not-greaterp}{standard-char-p}
@item alpha-char-p @tab char-not-equal @tab char>
@item alphanumericp @tab char-not-greaterp @tab char>=
@item both-case-p @tab char-not-lessp @tab digit-char-p
@item char-code-limit @tab char/= @tab graphic-char-p
@item char-equal @tab char< @tab lower-case-p
@item char-greaterp @tab char<= @tab standard-char-p
@item char-lessp @tab char= @tab upper-case-p
@end multitable
@end cartouche
@caption{Character defined names -- 1}
@end float
@Thenextfigure{}@spc{}lists some @term{character} construction and conversion @term{defined names}.
@float Figure,fig13.2
@cartouche
@multitable{char-downcase}{char-upcase}{digit-char}
@item char-code @tab char-name @tab code-char
@item char-downcase @tab char-upcase @tab digit-char
@item char-int @tab character @tab name-char
@end multitable
@end cartouche
@caption{Character defined names -- 2}
@end float
@node Introduction to Scripts and Repertoires
@subsection Introduction to Scripts and Repertoires
@node Character Scripts
@subsubsection Character Scripts
A @term{script} is one of possibly several sets that form an @term{exhaustive partition}
of the type @symbolref{character, SC}.
The number of such sets and boundaries between them is @term{implementation-defined}.
@clisp{}@spc{}does not require these sets to be @term{types}, but an @term{implementation}
is permitted to define such @term{types} as an extension. Since no @term{character}
from one @term{script} can ever be a member of another @term{script}, it is generally
more useful to speak about @term{character} @term{repertoires}.
Although
the term ``@term{script}'' is chosen for
definitional
compatibility with ISO terminology, no @term{conforming implementation}
is required to use any particular @term{scripts} standardized by ISO
or by any other standards organization.
Whether and how the @term{script} or @term{scripts} used by any given
@term{implementation} are named is @term{implementation-dependent}.
@node Character Repertoires
@subsubsection Character Repertoires
A @newterm{repertoire} is a @term{type specifier} for a @subtypeof{character}.
This term is generally used when describing a collection of @term{characters}
independent of their coding.
@term{Characters} in @term{repertoires} are only identified
by name,
by @term{glyph}, or
by character description.
A @term{repertoire} can contain @term{characters} from several
@term{scripts}, and a @term{character} can appear in more than
one @term{repertoire}.
For some examples of @term{repertoires}, see the coded character standards
ISO 8859/1, ISO 8859/2, and ISO 6937/2.
Note, however, that although
the term ``@term{repertoire}'' is chosen for
definitional
compatibility with ISO terminology, no @term{conforming implementation}
is required to use @term{repertoires} standardized by ISO or any other
standards organization.
@node Character Attributes
@subsection Character Attributes
@term{Characters} have only one @term{standardized} @term{attribute}:
a @term{code}. A @term{character}'s @term{code} is a non-negative @term{integer}.
This @term{code} is composed from a character @term{script} and a character label
in an @term{implementation-dependent} way. See the @term{functions} @ref{char-code} and @symbolref{code-char, SYM}.
Additional, @term{implementation-defined} @term{attributes} of @term{characters}
are also permitted
so that, for example,
two @term{characters} with the same @term{code} may differ
in some other, @term{implementation-defined} way.
For any @term{implementation-defined} @term{attribute}
there is a distinguished value
called the @newterm{null} value for that @term{attribute}.
A @term{character} for which each @term{implementation-defined} @term{attribute}
has the null value for that @term{attribute} is called a @term{simple} @term{character}.
If the @term{implementation} has no @term{implementation-defined} @term{attributes},
then all @term{characters} are @term{simple} @term{characters}.
@node Character Categories
@subsection Character Categories
There are several (overlapping) categories of @term{characters} that have no formally
associated @term{type} but that are nevertheless useful to name.
They include
@term{graphic} @term{characters},
@term{alphabetic}@sub{1} @term{characters},
@term{characters} with @term{case}
(@term{uppercase} and @term{lowercase} @term{characters}),
@term{numeric} @term{characters},
@term{alphanumeric} @term{characters},
and @term{digits} (in a given @term{radix}).
For each @term{implementation-defined} @term{attribute} of a @term{character},
the documentation for that @term{implementation} must specify whether
@term{characters} that differ only in that @term{attribute} are permitted to differ
in whether are not they are members of one of the aforementioned categories.
Note that these terms are defined independently of any special syntax
which might have been enabled in the @term{current readtable}.
@node Graphic Characters
@subsubsection Graphic Characters
@term{Characters} that are classified as @newterm{graphic}, or displayable, are each
associated with a glyph, a visual representation of the @term{character}.
A @term{graphic} @term{character} is one that has a standard textual
representation as a single @term{glyph}, such as @f{A} or @f{*} or @f{=}.
@term{Space}, which effectively has a blank @term{glyph}, is defined
to be a @term{graphic}.
Of the @term{standard characters},
@term{newline} is @term{non-graphic}
and all others are @term{graphic}; see @ref{Standard Characters}.
@term{Characters} that are not @term{graphic} are called @newterm{non-graphic}.
@term{Non-graphic} @term{characters} are sometimes informally called
``formatting characters''
or ``control characters.''
@f{#@bsl{}Backspace},
@f{#@bsl{}Tab},
@f{#@bsl{}Rubout},
@f{#@bsl{}Linefeed},
@f{#@bsl{}Return}, and
@f{#@bsl{}Page},
if they are supported by the @term{implementation},
are @term{non-graphic}.
@node Alphabetic Characters
@subsubsection Alphabetic Characters
The @term{alphabetic}@sub{1} @term{characters} are
a subset of the @term{graphic} @term{characters}.
Of the @term{standard characters}, only these are the @term{alphabetic}@sub{1} @term{characters}:
@f{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}
@f{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}
Any @term{implementation-defined} @term{character} that has @term{case}
must be @term{alphabetic}@sub{1}.
For each @term{implementation-defined} @term{graphic} @term{character}
that has no @term{case},
it is @term{implementation-defined} whether
that @term{character} is @term{alphabetic}@sub{1}.
@node Characters With Case
@subsubsection Characters With Case
The @term{characters} with @term{case} are
a subset of the @term{alphabetic}@sub{1} @term{characters}.
A @term{character} with @term{case} has the property of being either
@term{uppercase} or @term{lowercase}.
Every @term{character} with @term{case} is in one-to-one correspondence
with some other @term{character} with the opposite @term{case}.
@node Uppercase Characters
@subsubsection Uppercase Characters
An uppercase @term{character} is one that has a corresponding
@term{lowercase} @term{character} that is @term{different}
(and can be obtained using @symbolref{char-downcase, SYM}).
Of the @term{standard characters}, only these are @term{uppercase} @term{characters}:
@f{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}
@node Lowercase Characters
@subsubsection Lowercase Characters
A lowercase @term{character} is one that has a corresponding
@term{uppercase} @term{character} that is @term{different}
(and can be obtained using @symbolref{char-upcase, SYM}).
Of the @term{standard characters}, only these are @term{lowercase} @term{characters}:
@f{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}
@node Corresponding Characters in the Other Case
@subsubsection Corresponding Characters in the Other Case
The @term{uppercase} @term{standard characters} @f{A} through @f{Z} mentioned above
respectively correspond to
the @term{lowercase} @term{standard characters} @f{a} through @f{z} mentioned above.
For example, the @term{uppercase} @term{character} @f{E}
corresponds to the @term{lowercase} @term{character} @f{e}, and vice versa.
@node Case of Implementation-Defined Characters
@subsubsection Case of Implementation-Defined Characters
An @term{implementation} may define that other @term{implementation-defined}
@term{graphic} @term{characters} have @term{case}. Such definitions must always
be done in pairs---one @term{uppercase} @term{character} in one-to-one
@i{correspondence} with one @term{lowercase} @term{character}.
@node Numeric Characters
@subsubsection Numeric Characters
The @term{numeric} @term{characters} are
a subset of the @term{graphic} @term{characters}.
Of the @term{standard characters}, only these are @term{numeric} @term{characters}:
@f{0 1 2 3 4 5 6 7 8 9}
For each @term{implementation-defined} @term{graphic} @term{character}
that has no @term{case}, the @term{implementation} must define whether
or not it is a @term{numeric} @term{character}.
@node Alphanumeric Characters
@subsubsection Alphanumeric Characters
The set of @term{alphanumeric} @term{characters} is the union of
the set of @term{alphabetic}@sub{1} @term{characters}
and the set of @term{numeric} @term{characters}.
@node Digits in a Radix
@subsubsection Digits in a Radix
What qualifies as a @term{digit} depends on the @term{radix}
(an @term{integer} between @f{2} and @f{36}, inclusive).
The potential @term{digits} are:
@f{0 1 2 3 4 5 6 7 8 9 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}
Their respective weights are @f{0}, @f{1}, @f{2}, @mat{@ldots{}} @f{35}.
In any given radix @mat{n}, only the first @mat{n} potential @term{digits}
are considered to be @term{digits}.
For example,
the digits in radix @f{2} are @f{0} and @f{1},
the digits in radix @f{10} are @f{0} through @f{9}, and
the digits in radix @f{16} are @f{0} through @f{F}.
@term{Case} is not significant in @term{digits};
for example, in radix @f{16}, both @f{F} and @f{f}
are @term{digits} with weight @f{15}.
@node Identity of Characters
@subsection Identity of Characters
Two @term{characters} that are @symbolref{eql, F}, @symbolref{char=, SYM}, or @symbolref{char-equal, SYM}
are not necessarily @symbolref{eq, SYM}.
@node Ordering of Characters
@subsection Ordering of Characters
The total ordering on @term{characters} is guaranteed to have
the following properties:
@itemize @bullet{}
@item
If two @term{characters} have the same @term{implementation-defined} @term{attributes},
then their ordering by @symbolref{char<, SYM} is consistent with the numerical
ordering by the predicate @symbolref{<, SYM} on their code @term{attributes}.
@item If two @term{characters} differ in any @term{attribute}, then they
are not @symbolref{char=, SYM}.
@reviewer{Barmar: I wonder if we should say that the ordering may be dependent on the
@term{implementation-defined} @term{attributes}.}
@item
The total ordering is not necessarily the same as the total ordering
on the @term{integers} produced by applying @symbolref{char-int, SYM} to the
@term{characters}.
@item
While @term{alphabetic}@sub{1} @term{standard characters} of a given @term{case}
must
obey a partial ordering,
they need not be contiguous; it is permissible for
@term{uppercase} and @term{lowercase} @term{characters} to be interleaved.
Thus @f{(char<= #@bsl{}a x #@bsl{}z)}
is not a valid way of determining whether or not @f{x} is a
@term{lowercase} @term{character}.
@end itemize
Of the @term{standard characters},
those which are @term{alphanumeric} obey the following partial ordering:
@lisp
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
0<1<2<3<4<5<6<7<8<9
either 9<A or Z<0
either 9<a or z<0
@end lisp
This implies that, for @term{standard characters}, @term{alphabetic}@sub{1}
ordering holds within each @term{case} (@term{uppercase} and @term{lowercase}),
and that the @term{numeric} @term{characters} as a group are not interleaved
with @term{alphabetic} @term{characters}.
However, the ordering or possible interleaving of @term{uppercase} @term{characters}
and @term{lowercase} @term{characters} is @term{implementation-defined}.
@node Character Names
@subsection Character Names
The following @term{character} @term{names} must be present in all
@term{conforming implementations}:
@table @asis
@item @id{@f{Newline}}
The character that represents the division between lines.
An implementation must translate between @f{#@bsl{}Newline},
a single-character representation, and whatever external representation(s)
may be used.
@item @id{@f{Space}}
The space or blank character.
@end table
The following names are @term{semi-standard};
if an @term{implementation} supports them,
they should be used for the described @term{characters} and no others.
@table @asis
@item @id{@f{Rubout}}
The rubout or delete character.
@item @id{@f{Page}}
The form-feed or page-separator character.
@item @id{@f{Tab}}
The tabulate character.
@item @id{@f{Backspace}}
The backspace character.
@item @id{@f{Return}}
The carriage return character.
@item @id{@f{Linefeed}}
The line-feed character.
@end table
In some @term{implementations},
one or more of these @term{character} @term{names}
might denote a @term{standard character};
for example,
@f{#@bsl{}Linefeed} and @f{#@bsl{}Newline} might be the @term{same} @term{character}
in some @term{implementations}.
@node Treatment of Newline during Input and Output
@subsection Treatment of Newline during Input and Output
When the character @f{#@bsl{}Newline} is written to an output file,
the implementation must take the appropriate action
to produce a line division. This might involve writing out a
record or translating @f{#@bsl{}Newline} to a CR/LF sequence.
When reading, a corresponding reverse transformation must take place.
@node Character Encodings
@subsection Character Encodings
A @term{character} is sometimes represented merely by its @term{code}, and sometimes
by another @term{integer} value which is composed from the @term{code} and all
@term{implementation-defined} @term{attributes}
(in an @term{implementation-defined} way
that might vary between @term{Lisp images} even in the same @term{implementation}).
This @term{integer}, returned by the function @symbolref{char-int, SYM}, is called the
character's ``encoding.''
There is no corresponding function
from a character's encoding back to the @term{character},
since its primary intended uses include things like hashing where an inverse operation
is not really called for.
@node Documentation of Implementation-Defined Scripts
@subsection Documentation of Implementation-Defined Scripts
An @term{implementation} must document the @term{character} @term{scripts}
it supports. For each @term{character} @term{script} supported,
the documentation must describe at least the following:
@itemize @bullet{}
@item
Character labels, glyphs, and descriptions.
Character labels must be uniquely named using only Latin capital letters A--Z,
hyphen (-), and digits 0--9.
@item
Reader canonicalization.
Any mechanisms by which @symbolref{read, SYM} treats
@term{different} characters as equivalent must be documented.
@item
The impact on @symbolref{char-upcase, SYM},
@symbolref{char-downcase, SYM},
and the case-sensitive @term{format directives}.
In particular, for each @term{character} with @term{case},
whether it is @term{uppercase} or @term{lowercase},
and which @term{character} is its equivalent in the opposite case.
@item
The behavior of the case-insensitive @term{functions}
@symbolref{char-equal, SYM}, @symbolref{char-not-equal, SYM},
@symbolref{char-lessp, SYM}, @symbolref{char-greaterp, SYM},
@symbolref{char-not-greaterp, SYM}, and @symbolref{char-not-lessp, SYM}.
@item
The behavior of any @term{character} @term{predicates};
in particular, the effects of
@symbolref{alpha-char-p, SYM},
@symbolref{lower-case-p, SYM},
@symbolref{upper-case-p, SYM},
@symbolref{both-case-p, SYM},
@symbolref{graphic-char-p, SYM},
and
@symbolref{alphanumericp, SYM}.
@item
The interaction with file I/O, in particular,
the supported coded character sets (for example, ISO8859/1-1987)
and external encoding schemes supported are documented.
@end itemize
@node Characters Dictionary
@section Characters Dictionary
@menu
* character (System Class)::
* base-char::
* standard-char::
* extended-char::
* char=; char/=; char<; char>; char<=; char>=; char-equal; char-not-equal+::
* character (Function)::
* characterp::
* alpha-char-p::
* alphanumericp::
* digit-char::
* digit-char-p::
* graphic-char-p::
* standard-char-p::
* char-upcase; char-downcase::
* upper-case-p; lower-case-p; both-case-p::
* char-code::
* char-int::
* code-char::
* char-code-limit::
* char-name::
* name-char::
@end menu
@node character (System Class)
@syindexanchor{character, SC}
@subsection character (System Class)
@cindex character
@subsubheading Class Precedence List:
@symbolref{character, SC},
@symbolref{t, SC}
@subsubheading Description:
A @term{character} is an @term{object} that
represents a unitary token in an aggregate quantity of text;
see @ref{Character Concepts}.
@Thetypes{base-char} and @symbolref{extended-char, SYM}
form an @term{exhaustive partition} of @thetype{character}.
@subsubheading See Also:
@ref{Character Concepts},
@ref{Sharpsign Backslash},
@ref{Printing Characters}
@node base-char
@syindexanchor{base-char, SYM}
@subsection base-char (Type)
@cindex base-char
@subsubheading Supertypes:
@symbolref{base-char, SYM},
@symbolref{character, SC},
@symbolref{t, SC}
@subsubheading Description:
@Thetype{base-char} is defined as the @term{upgraded array element type}
of @symbolref{standard-char, SYM}.
An @term{implementation} can support additional @subtypesof{character}
(besides the ones listed in this standard)
that might or might not be @supertypesof{base-char}.
In addition, an @term{implementation} can define @symbolref{base-char, SYM}
to be the @term{same} @term{type} as @symbolref{character, SC}.
@term{Base characters} are distinguished in the following respects:
@enumerate 1
@item @Thetype{standard-char} is a @term{subrepertoire} of @thetype{base-char}.
@item The selection of @term{base characters} that are not @term{standard characters}
is implementation defined.
@item Only @term{objects} of @thetype{base-char} can be
@term{elements} of a @term{base string}.
@item
No upper bound is specified for the number of characters in the
@symbolref{base-char, SYM} @term{repertoire}; the size of that @term{repertoire}
is
@term{implementation-defined}.
The lower bound is@tie{}96, the number of @term{standard characters}.
@end enumerate
Whether a character is a @term{base character} depends on the way
that an @term{implementation} represents @term{strings},
and not any other properties of the @term{implementation} or the host operating system.
For example, one implementation might encode all @term{strings}
as characters having 16-bit encodings, and another might have
two kinds of @term{strings}: those with characters having 8-bit
encodings and those with characters having 16-bit encodings. In the
first @term{implementation}, @thetype{base-char} is equivalent to
@thetype{character}: there is only one kind of @term{string}.
In the second @term{implementation}, the @term{base characters} might be
those @term{characters} that could be stored in a @term{string} of @term{characters}
having 8-bit encodings. In such an implementation,
@thetype{base-char} is a @term{proper subtype} of @thetype{character}.
@Thetype{standard-char} is a
@subtypeof{base-char}.
@node standard-char
@syindexanchor{standard-char, SYM}
@subsection standard-char (Type)
@cindex standard-char
@subsubheading Supertypes:
@symbolref{standard-char, SYM},
@symbolref{base-char, SYM},
@symbolref{character, SC},
@symbolref{t, SC}
@subsubheading Description:
A fixed set of 96 @term{characters} required to be present in all
@term{conforming implementations}. @term{Standard characters} are
defined in @ref{Standard Characters}.
Any @term{character} that is not @term{simple} is not a @term{standard character}.
@subsubheading See Also:
@ref{Standard Characters}
@node extended-char
@syindexanchor{extended-char, SYM}
@subsection extended-char (Type)
@cindex extended-char
@subsubheading Supertypes:
@symbolref{extended-char, SYM},
@symbolref{character, SC},
@symbolref{t, SC}
@subsubheading Description:
@Thetype{extended-char} is equivalent to the @term{type} @f{(and character (not base-char))}.
@subsubheading Notes:
@Thetype{extended-char} might
have no @term{elements}@sub{4}
in @term{implementations} in which all @term{characters} are @oftype{base-char}.
@node char=; char/=; char<; char>; char<=; char>=; char-equal; char-not-equal+
@syindexanchor{char=, SYM}
@syindexanchor{char/=, SYM}
@syindexanchor{char<, SYM}
@syindexanchor{char>, SYM}
@syindexanchor{char<=, SYM}
@syindexanchor{char>=, SYM}
@syindexanchor{char-equal, SYM}
@syindexanchor{char-not-equal, SYM}
@syindexanchor{char-lessp, SYM}
@syindexanchor{char-greaterp, SYM}
@syindexanchor{char-not-greaterp, SYM}
@syindexanchor{char-not-lessp, SYM}
@subsection char=, char/=, char<, char>, char<=, char>=, char-equal, char-not-equal, char-lessp, char-greaterp, char-not-greaterp, char-not-lessp (Function)
@cindex char=
@cindex char/=
@cindex char<
@cindex char>
@cindex char<=
@cindex char>=
@cindex char-equal
@cindex char-not-equal
@cindex char-lessp
@cindex char-greaterp
@cindex char-not-greaterp
@cindex char-not-lessp
@anchor{char=}
@anchor{char-equal}
@subsubheading Syntax:
@DefunWithValues{char@mat{=}, @rest{} @plus{characters}, generalized-boolean}
@DefunWithValues{char@mat{/=}, @rest{} @plus{characters}, generalized-boolean}
@DefunWithValues{char@mat{<}, @rest{} @plus{characters}, generalized-boolean}
@DefunWithValues{char@mat{>}, @rest{} @plus{characters}, generalized-boolean}
@DefunWithValues{char@mat{<=}, @rest{} @plus{characters}, generalized-boolean}
@DefunWithValues{char@mat{>=}, @rest{} @plus{characters}, generalized-boolean}
@DefunWithValues{char-equal, @rest{} @plus{characters}, generalized-boolean}
@DefunWithValues{char-not-equal, @rest{} @plus{characters}, generalized-boolean}
@DefunWithValues{char-lessp, @rest{} @plus{characters}, generalized-boolean}
@DefunWithValues{char-greaterp, @rest{} @plus{characters}, generalized-boolean}
@DefunWithValues{char-not-greaterp, @rest{} @plus{characters}, generalized-boolean}
@DefunWithValues{char-not-lessp, @rest{} @plus{characters}, generalized-boolean}
@subsubheading Arguments and Values:
@param{character}---a @term{character}.
@param{generalized-boolean}---a @term{generalized boolean}.
@subsubheading Description:
These predicates compare @term{characters}.
@symbolref{char=, SYM} returns @term{true} if all @param{characters} are the @term{same};
otherwise, it returns @term{false}.
If two @param{characters} differ
in any @term{implementation-defined} @term{attributes},
then they are not @symbolref{char=, SYM}.
@symbolref{char/=, SYM} returns @term{true} if all @param{characters} are different;
otherwise, it returns @term{false}.
@symbolref{char<, SYM} returns @term{true} if the @param{characters} are monotonically increasing;
otherwise, it returns @term{false}.
If two @term{characters}
have @term{identical} @term{implementation-defined} @term{attributes},
then their ordering by @symbolref{char<, SYM} is
consistent with the numerical ordering by the predicate @f{<} on their @term{codes}.
@symbolref{char>, SYM} returns @term{true} if the @param{characters} are monotonically decreasing;
otherwise, it returns @term{false}.
If two @term{characters} have
@term{identical} @term{implementation-defined} @term{attributes},
then their ordering by @symbolref{char>, SYM} is
consistent with the numerical ordering by the predicate @f{>} on their @term{codes}.
@symbolref{char<=, SYM} returns @term{true}
if the @param{characters} are monotonically nondecreasing;
otherwise, it returns @term{false}.
If two @term{characters} have
@term{identical} @term{implementation-defined} @term{attributes},
then their ordering by @symbolref{char<=, SYM} is
consistent with the numerical ordering by the predicate @f{<=} on their @term{codes}.
@symbolref{char>=, SYM} returns @term{true}
if the @param{characters} are monotonically nonincreasing;
otherwise, it returns @term{false}.
If two @term{characters} have
@term{identical} @term{implementation-defined} @term{attributes},
then their ordering by @symbolref{char>=, SYM} is
consistent with the numerical ordering by the predicate @f{>=} on their @term{codes}.
@symbolref{char-equal, SYM},
@symbolref{char-not-equal, SYM},
@symbolref{char-lessp, SYM},
@symbolref{char-greaterp, SYM},
@symbolref{char-not-greaterp, SYM},
and @symbolref{char-not-lessp, SYM}
are similar to
@symbolref{char=, SYM},
@symbolref{char/=, SYM},
@symbolref{char<, SYM},
@symbolref{char>, SYM},
@symbolref{char<=, SYM},
@symbolref{char>=, SYM},
respectively,
except that they ignore differences in @term{case} and
might have an @term{implementation-defined} behavior
for @term{non-simple} @term{characters}.
For example, an @term{implementation} might define that
@symbolref{char-equal, SYM}, @i{etc.} ignore certain
@term{implementation-defined} @term{attributes}.
The effect, if any,
of each @term{implementation-defined} @term{attribute}
upon these functions must be specified as part of the definition of that @term{attribute}.
@subsubheading Examples:
@lisp
(char= #@bsl{}d #@bsl{}d) @EV{} @term{true}
(char= #@bsl{}A #@bsl{}a) @EV{} @term{false}
(char= #@bsl{}d #@bsl{}x) @EV{} @term{false}
(char= #@bsl{}d #@bsl{}D) @EV{} @term{false}
(char/= #@bsl{}d #@bsl{}d) @EV{} @term{false}
(char/= #@bsl{}d #@bsl{}x) @EV{} @term{true}
(char/= #@bsl{}d #@bsl{}D) @EV{} @term{true}
(char= #@bsl{}d #@bsl{}d #@bsl{}d #@bsl{}d) @EV{} @term{true}
(char/= #@bsl{}d #@bsl{}d #@bsl{}d #@bsl{}d) @EV{} @term{false}
(char= #@bsl{}d #@bsl{}d #@bsl{}x #@bsl{}d) @EV{} @term{false}
(char/= #@bsl{}d #@bsl{}d #@bsl{}x #@bsl{}d) @EV{} @term{false}
(char= #@bsl{}d #@bsl{}y #@bsl{}x #@bsl{}c) @EV{} @term{false}
(char/= #@bsl{}d #@bsl{}y #@bsl{}x #@bsl{}c) @EV{} @term{true}
(char= #@bsl{}d #@bsl{}c #@bsl{}d) @EV{} @term{false}
(char/= #@bsl{}d #@bsl{}c #@bsl{}d) @EV{} @term{false}
(char< #@bsl{}d #@bsl{}x) @EV{} @term{true}
(char<= #@bsl{}d #@bsl{}x) @EV{} @term{true}
(char< #@bsl{}d #@bsl{}d) @EV{} @term{false}
(char<= #@bsl{}d #@bsl{}d) @EV{} @term{true}
(char< #@bsl{}a #@bsl{}e #@bsl{}y #@bsl{}z) @EV{} @term{true}
(char<= #@bsl{}a #@bsl{}e #@bsl{}y #@bsl{}z) @EV{} @term{true}
(char< #@bsl{}a #@bsl{}e #@bsl{}e #@bsl{}y) @EV{} @term{false}
(char<= #@bsl{}a #@bsl{}e #@bsl{}e #@bsl{}y) @EV{} @term{true}
(char> #@bsl{}e #@bsl{}d) @EV{} @term{true}
(char>= #@bsl{}e #@bsl{}d) @EV{} @term{true}
(char> #@bsl{}d #@bsl{}c #@bsl{}b #@bsl{}a) @EV{} @term{true}
(char>= #@bsl{}d #@bsl{}c #@bsl{}b #@bsl{}a) @EV{} @term{true}
(char> #@bsl{}d #@bsl{}d #@bsl{}c #@bsl{}a) @EV{} @term{false}
(char>= #@bsl{}d #@bsl{}d #@bsl{}c #@bsl{}a) @EV{} @term{true}
(char> #@bsl{}e #@bsl{}d #@bsl{}b #@bsl{}c #@bsl{}a) @EV{} @term{false}
(char>= #@bsl{}e #@bsl{}d #@bsl{}b #@bsl{}c #@bsl{}a) @EV{} @term{false}
(char> #@bsl{}z #@bsl{}A) @EV{} @term{implementation-dependent}
(char> #@bsl{}Z #@bsl{}a) @EV{} @term{implementation-dependent}
(char-equal #@bsl{}A #@bsl{}a) @EV{} @term{true}
(stable-sort (list #@bsl{}b #@bsl{}A #@bsl{}B #@bsl{}a #@bsl{}c #@bsl{}C) #'char-lessp)
@EV{} (#@bsl{}A #@bsl{}a #@bsl{}b #@bsl{}B #@bsl{}c #@bsl{}C)
(stable-sort (list #@bsl{}b #@bsl{}A #@bsl{}B #@bsl{}a #@bsl{}c #@bsl{}C) #'char<)
@EV{} (#@bsl{}A #@bsl{}B #@bsl{}C #@bsl{}a #@bsl{}b #@bsl{}c) ;Implementation A
@EV{} (#@bsl{}a #@bsl{}b #@bsl{}c #@bsl{}A #@bsl{}B #@bsl{}C) ;Implementation B
@EV{} (#@bsl{}a #@bsl{}A #@bsl{}b #@bsl{}B #@bsl{}c #@bsl{}C) ;Implementation C
@EV{} (#@bsl{}A #@bsl{}a #@bsl{}B #@bsl{}b #@bsl{}C #@bsl{}c) ;Implementation D
@EV{} (#@bsl{}A #@bsl{}B #@bsl{}a #@bsl{}b #@bsl{}C #@bsl{}c) ;Implementation E
@end lisp
@subsubheading Exceptional Situations:
@Shouldcheckplus{character}
@subsubheading See Also:
@ref{Character Syntax},
@ref{Documentation of Implementation-Defined Scripts}
@subsubheading Notes:
If characters differ in their @term{code} @term{attribute}
or any @term{implementation-defined} @term{attribute},
they are considered to be different by @symbolref{char=, SYM}.
There is no requirement that @f{(eq c1 c2)} be true merely because
@f{(char= c1 c2)} is @term{true}. While @symbolref{eq, SYM} can distinguish two
@term{characters}
that @symbolref{char=, SYM} does not, it is distinguishing them not
as @term{characters}, but in some sense on the basis of a lower level
implementation characteristic.
If @f{(eq c1 c2)} is @term{true},
then @f{(char= c1 c2)} is also true.
@symbolref{eql, F} and @symbolref{equal, SYM}
compare @term{characters} in the same
way that @symbolref{char=, SYM} does.
The manner in which @term{case} is used by
@symbolref{char-equal, SYM},
@symbolref{char-not-equal, SYM},
@symbolref{char-lessp, SYM},
@symbolref{char-greaterp, SYM},
@symbolref{char-not-greaterp, SYM},
and @symbolref{char-not-lessp, SYM}
implies an ordering for @term{standard characters} such that
@f{A=a}, @f{B=b}, and so on, up to @f{Z=z}, and furthermore either
@f{9<A} or @f{Z<0}.
@node character (Function)
@syindexanchor{character, F}
@subsection character (Function)
@cindex character
@subsubheading Syntax:
@DefunWithValues{character, character, denoted-character}
@subsubheading Arguments and Values:
@param{character}---a @term{character designator}.
@param{denoted-character}---a @term{character}.
@subsubheading Description:
Returns the @term{character} denoted by the @param{character} @term{designator}.
@subsubheading Examples:
@lisp
(character #@bsl{}a) @EV{} #@bsl{}a
(character "a") @EV{} #@bsl{}a
(character 'a) @EV{} #@bsl{}A
(character '@bsl{}a) @EV{} #@bsl{}a
(character 65.) is an error.
(character 'apple) is an error.
@end lisp
@subsubheading Exceptional Situations:
@Shouldchecktype{object, a @term{character designator}}
@subsubheading See Also:
@ref{coerce}
@subsubheading Notes:
@lisp
(character @param{object}) @EQ{} (coerce @param{object} 'character)
@end lisp
@node characterp
@syindexanchor{characterp, SYM}
@subsection characterp (Function)
@cindex characterp
@subsubheading Syntax:
@DefunWithValues{characterp, object, generalized-boolean}
@subsubheading Arguments and Values:
@param{object}---an @term{object}.
@param{generalized-boolean}---a @term{generalized boolean}.
@subsubheading Description:
@TypePredicate{object, character}
@subsubheading Examples:
@lisp
(characterp #@bsl{}a) @EV{} @term{true}
(characterp 'a) @EV{} @term{false}
(characterp "a") @EV{} @term{false}
(characterp 65.) @EV{} @term{false}
(characterp #@bsl{}Newline) @EV{} @term{true}
;; This next example presupposes an implementation
;; in which #@bsl{}Rubout is an implementation-defined character.
(characterp #@bsl{}Rubout) @EV{} @term{true}
@end lisp
@subsubheading See Also:
@ref{character (Function)} (@term{type} and @term{function}), @ref{typep}
@subsubheading Notes:
@lisp
(characterp @param{object}) @EQ{} (typep @param{object} 'character)
@end lisp
@node alpha-char-p
@syindexanchor{alpha-char-p, SYM}
@subsection alpha-char-p (Function)
@cindex alpha-char-p
@subsubheading Syntax: