chickadee » scheme » integer->char

char->integer charprocedure
integer->char nprocedure

Given a character, char->integer returns an exact integer representation of the character. Given an exact integer that is the image of a character under char->integer, integer->char returns that character. These procedures implement order-preserving isomorphisms between the set of characters under the char<=? ordering and some subset of the integers under the <= ordering. That is, if

(char<=? a b) ===> #t  and  (<= x y) ===> #t

and x and y are in the domain of integer->char, then

(<= (char->integer a)
    (char->integer b))                  ===>  #t

(char<=? (integer->char x)
         (integer->char y))             ===>  #t

Note that integer->char does currently not detect a negative argument and will quietly convert -1 to #x1ffff in CHICKEN.