Next: , Previous: Fluid/dynamic bindings, Up: System features


4.1.5 ASCII character encoding

These names are exported by the ascii structure.

— procedure: char->ascii char –> ascii-integer
— procedure: ascii->char ascii-integer –> character

These convert characters to and from their integer ASCII encodings. Char->ascii and ascii->char are similar to R5RS's char->integer and integer->char, but they are guaranteed to use the ASCII encoding. Scheme48's integer->char and char->integer deliberately do not use the ASCII encoding to encourage programmers to make use of only what R5RS guarantees.

          (char->ascii #\a)                       => 97
          (ascii->char 97)                        => #\a
— constant: ascii-limit –> integer
— constant: ascii-whitespaces –> ascii-integer-list

Ascii-limit is an integer that is one greater than the highest number that char->ascii may return or ascii->char will accept. Ascii-whitespaces is a list of the integer encodings of all characters that are considered whitespace: space (32), horizontal tab (9), line-feed/newline (10), vertical tab (11), form-feed/page (12), and carriage return (13).