User Tools


======Function CHAR=, CHAR/=, CHAR<, CHAR>, CHAR<=, CHAR>=, CHAR-EQUAL, CHAR-NOT-EQUAL, CHAR-LESSP, CHAR-GREATERP, CHAR-NOT-GREATERP, CHAR-NOT-LESSP====== ====Syntax==== * **char=** //''&rest'' characters''+''// → //generalized-boolean// * **char/=** //''&rest'' characters''+''// → //generalized-boolean// * **char<** //''&rest'' characters''+''// → //generalized-boolean// * **char>** //''&rest'' characters''+''// → //generalized-boolean// * **char<=** //''&rest'' characters''+''// → //generalized-boolean// * **char>=** //''&rest'' characters''+''// → //generalized-boolean// * **char-equal** //''&rest'' characters''+''// → //generalized-boolean// * **char-not-equal** //''&rest'' characters''+''// → //generalized-boolean// * **char-lessp** //''&rest'' characters''+''// → //generalized-boolean// * **char-greaterp** //''&rest'' characters''+''// → //generalized-boolean// * **char-not-greaterp** //''&rest'' characters''+''// → //generalized-boolean// * **char-not-lessp** //''&rest'' characters''+''// → //generalized-boolean// ====Arguments and Values==== * //character// - a //[[CL:Glossary:character]]//. * //generalized-boolean// - a //[[CL:Glossary:generalized boolean]]//. ====Description==== These predicates compare //[[CL:Glossary:character|characters]]//. **char=** returns //[[CL:Glossary:true]]// if all //characters// are the //[[CL:Glossary:same]]//; otherwise, it returns //[[CL:Glossary:false]]//. If two //characters// differ in any //[[CL:Glossary:implementation-defined]]// //[[CL:Glossary:attribute|attributes]]//, then they are not **char=**. **char/=** returns //[[CL:Glossary:true]]// if all //characters// are different; otherwise, it returns //[[CL:Glossary:false]]//. **char<** returns //[[CL:Glossary:true]]// if the //characters// are monotonically increasing; otherwise, it returns //[[CL:Glossary:false]]//. If two //[[CL:Glossary:character|characters]]// have //[[CL:Glossary:identical]]// //[[CL:Glossary:implementation-defined]]// //[[CL:Glossary:attribute|attributes]]//, then their ordering by **char<** is consistent with the numerical ordering by the predicate ''<'' on their //[[CL:Glossary:codes]]//. **char>** returns //[[CL:Glossary:true]]// if the //characters// are monotonically decreasing; otherwise, it returns //[[CL:Glossary:false]]//. If two //[[CL:Glossary:character|characters]]// have //[[CL:Glossary:identical]]// //[[CL:Glossary:implementation-defined]]// //[[CL:Glossary:attribute|attributes]]//, then their ordering by **char>** is consistent with the numerical ordering by the predicate ''>'' on their //[[CL:Glossary:codes]]//. **char<=** returns //[[CL:Glossary:true]]// if the //characters// are monotonically nondecreasing; otherwise, it returns //[[CL:Glossary:false]]//. If two //[[CL:Glossary:character|characters]]// have //[[CL:Glossary:identical]]// //[[CL:Glossary:implementation-defined]]// //[[CL:Glossary:attribute|attributes]]//, then their ordering by **char<=** is consistent with the numerical ordering by the predicate ''<='' on their //[[CL:Glossary:codes]]//. **char>=** returns //[[CL:Glossary:true]]// if the //characters// are monotonically nonincreasing; otherwise, it returns //[[CL:Glossary:false]]//. If two //[[CL:Glossary:character|characters]]// have //[[CL:Glossary:identical]]// //[[CL:Glossary:implementation-defined]]// //[[CL:Glossary:attribute|attributes]]//, then their ordering by **char>=** is consistent with the numerical ordering by the predicate ''>='' on their //[[CL:Glossary:codes]]//. **char-equal**, **char-not-equal**, **char-lessp**, **char-greaterp**, **char-not-greaterp**, and **char-not-lessp** are similar to **char=**, **char/=**, **char<**, **char>**, **char<=**, **char>=**, respectively, except that they ignore differences in //[[CL:Glossary:case]]// and might have an //[[CL:Glossary:implementation-defined]]// behavior for //[[CL:Glossary:non-simple]]// //[[CL:Glossary:character|characters]]//. For example, an //[[CL:Glossary:implementation]]// might define that **char-equal**, etc. ignore certain //[[CL:Glossary:implementation-defined]]// //[[CL:Glossary:attribute|attributes]]//. The effect, if any, of each //[[CL:Glossary:implementation-defined]]// //[[CL:Glossary:attribute]]// upon these functions must be specified as part of the definition of that //[[CL:Glossary:attribute]]//. ====Examples==== <blockquote> (char= #\d #\d) <r>//[[CL:Glossary:true]]//</r> (char= #\A #\a) <r>//[[CL:Glossary:false]]//</r> (char= #\d #\x) <r>//[[CL:Glossary:false]]//</r> (char= #\d #\D) <r>//[[CL:Glossary:false]]//</r> (char/= #\d #\d) <r>//[[CL:Glossary:false]]//</r> (char/= #\d #\x) <r>//[[CL:Glossary:true]]//</r> (char/= #\d #\D) <r>//[[CL:Glossary:true]]//</r> (char= #\d #\d #\d #\d) <r>//[[CL:Glossary:true]]//</r> (char/= #\d #\d #\d #\d) <r>//[[CL:Glossary:false]]//</r> (char= #\d #\d #\x #\d) <r>//[[CL:Glossary:false]]//</r> (char/= #\d #\d #\x #\d) <r>//[[CL:Glossary:false]]//</r> (char= #\d #\y #\x #\c) <r>//[[CL:Glossary:false]]//</r> (char/= #\d #\y #\x #\c) <r>//[[CL:Glossary:true]]//</r> (char= #\d #\c #\d) <r>//[[CL:Glossary:false]]//</r> (char/= #\d #\c #\d) <r>//[[CL:Glossary:false]]//</r> (char< #\d #\x) <r>//[[CL:Glossary:true]]//</r> (char<= #\d #\x) <r>//[[CL:Glossary:true]]//</r> (char< #\d #\d) <r>//[[CL:Glossary:false]]//</r> (char<= #\d #\d) <r>//[[CL:Glossary:true]]//</r> (char< #\a #\e #\y #\z) <r>//[[CL:Glossary:true]]//</r> (char<= #\a #\e #\y #\z) <r>//[[CL:Glossary:true]]//</r> (char< #\a #\e #\e #\y) <r>//[[CL:Glossary:false]]//</r> (char<= #\a #\e #\e #\y) <r>//[[CL:Glossary:true]]//</r> (char> #\e #\d) <r>//[[CL:Glossary:true]]//</r> (char>= #\e #\d) <r>//[[CL:Glossary:true]]//</r> (char> #\d #\c #\b #\a) <r>//[[CL:Glossary:true]]//</r> (char>= #\d #\c #\b #\a) <r>//[[CL:Glossary:true]]//</r> (char> #\d #\d #\c #\a) <r>//[[CL:Glossary:false]]//</r> (char>= #\d #\d #\c #\a) <r>//[[CL:Glossary:true]]//</r> (char> #\e #\d #\b #\c #\a) <r>//[[CL:Glossary:false]]//</r> (char>= #\e #\d #\b #\c #\a) <r>//[[CL:Glossary:false]]//</r> (char> #\z #\A) <r>//[[CL:Glossary:implementation-dependent]]//</r> (char> #\Z #\a) <r>//[[CL:Glossary:implementation-dependent]]//</r> (char-equal #\A #\a) <r>//[[CL:Glossary:true]]//</r> ([[CL:Functions:stable-sort]] ([[CL:Functions:list]] #\b #\A #\B #\a #\c #\C) #'char-lessp) <r>(#\A #\a #\b #\B #\c #\C) </r> ([[CL:Functions:stable-sort]] ([[CL:Functions:list]] #\b #\A #\B #\a #\c #\C) #'char<) <r>(#\A #\B #\C #\a #\b #\c) ; Implementation A //or// (#\a #\b #\c #\A #\B #\C) ; Implementation B //or// (#\a #\A #\b #\B #\c #\C) ; Implementation C //or// (#\A #\a #\B #\b #\C #\c) ; Implementation D //or// (#\A #\B #\a #\b #\C #\c) ; Implementation E</r> </blockquote> ====Affected By==== None. ====Exceptional Situations==== Should signal an error of [[CL:Glossary:type]] [[CL:Errors:program-error]] if at least one //character// is not supplied. ====See Also==== {\secref\CharacterSyntax}, {\secref\ImplementationDefinedScripts} ====Notes==== If characters differ in their //[[CL:Glossary:code]]// //[[CL:Glossary:attribute]]// or any //[[CL:Glossary:implementation-defined]]// //[[CL:Glossary:attribute]]//, they are considered to be different by **char=**. There is no requirement that ''([[CL:Functions:eq]] c1 c2)'' be true merely because ''(char= c1 c2)'' is //[[CL:Glossary:true]]//. While **[[CL:Functions:eq]]** can distinguish two //[[CL:Glossary:character|characters]]// that **char=** does not, it is distinguishing them not as //[[CL:Glossary:character|characters]]//, but in some sense on the basis of a lower level implementation characteristic. If ''([[CL:Functions:eq]] c1 c2)'' is //[[CL:Glossary:true]]//, then ''(char= c1 c2)'' is also true. **[[CL:Functions:eql]]** and **[[CL:Functions:equal]]** compare //[[CL:Glossary:character|characters]]// in the same way that **char=** does. The manner in which //[[CL:Glossary:case]]// is used by **char-equal**, **char-not-equal**, **char-lessp**, **char-greaterp**, **char-not-greaterp**, and **char-not-lessp** implies an ordering for //[[CL:Glossary:standard characters]]// such that ''A=a'', ''B=b'', and so on, up to ''Z=z'', and furthermore either ''9<A'' or ''Z<0''. \issue{CHARACTER-PROPOSAL:2-1-1} \issue{CHARACTER-PROPOSAL:2-1-1} \issue{CHARACTER-PROPOSAL:2-1-1} \issue{CHARACTER-PROPOSAL:2-1-1} \issue{CHARACTER-PROPOSAL:2-1-1} \issue{CHARACTER-PROPOSAL:2-1-1} \issue{CHARACTER-PROPOSAL:2-1-1}