2.4. Characters

ECL has only one type of characters, which fits in the C type char. The following constants and functions operate on characters.


Each character is assigned an integer code which ranges from 0 to (CHAR_CODE_LIMIT-1).

 Function: cl_fixnum CHAR_CODE (cl_object o)
 Function: cl_fixnum char_code (cl_object o)

Returns the integer code associated to a lisp character. Only char_code checks its arguments.

 Function: cl_object CODE_CHAR (cl_fixnum o)

Returns the lisp character associated to an integer code. It does not check its arguments.

 Function: cl_object coerce_to_character (cl_object o)

Coerces a lisp object to type character. Valid arguments are a character, or a string designator of length 1. In all other cases an error is signaled.

 Function: bool char_eq (cl_object x, cl_object y)
 Function: bool char_equal (cl_object x, cl_object y)

Compare two characters for equality. char_eq take case into account and char_equal ignores it.

 Function: int char_cmp (cl_object x, cl_object y)
 Function: int char_compare (cl_object x, cl_object y)

Compare the relative order of two characters. char_cmp takes care of case and char_compare converts all characters to uppercase before comparing them.