DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH
 

(r5rs.info.gz) Characters

Info Catalog (r5rs.info.gz) Symbols (r5rs.info.gz) Other data types (r5rs.info.gz) Strings
 
 6.3.4 Characters
 ----------------
 
 Characters are objects that represent printed characters such as
 letters and digits.  Characters are written using the notation
 #\<character> or #\<character name>.  For example:
 
                              begin-tabular
     #\a
           ; lower case letter
 
     #\A
           ; upper case letter
 
     #\(
           ; left parenthesis
 
     #\
           ; the space character
 
     #\space
           ; the preferred way to write a space
 
     #\newline
           ; the newline character
 
 
 
 Case is significant in #\<character>, but not in #\<character name>.
 
 If <character> in #\<character> is alphabetic, then the character
 following <character> must be a delimiter character such as a space or
 parenthesis.  This rule resolves the ambiguous case where, for example,
 the sequence of characters "#\ space" could be taken to be either a
 representation of the space character or a representation of the
 character "#\ s" followed by a representation of the symbol "pace."
 
 Characters written in the #\ notation are self-evaluating.  That is,
 they do not have to be quoted in programs.
 
 Some of the procedures that operate on characters ignore the difference
 between upper case and lower case.  The procedures that ignore case
 have "-ci" (for "case insensitive") embedded in their names.
 
  -- procedure: char? obj
      Returns #t if OBJ is a character, otherwise returns #f.
 
 
  -- procedure: char=? char1 char2
  -- procedure: char<? char1 char2
  -- procedure: char>? char1 char2
  -- procedure: char<=? char1 char2
  -- procedure: char>=? char1 char2
      These procedures impose a total ordering on the set of characters.
      It is guaranteed that under this ordering:
 
         * The upper case characters are in order.  For example,
           `(char<? #\A #\B)' returns #t.
 
         * The lower case characters are in order.  For example,
           `(char<? #\a #\b)' returns #t.
 
         * The digits are in order.  For example, `(char<? #\0 #\9)'
           returns #t.
 
         * Either all the digits precede all the upper case letters, or
           vice versa.
 
         * Either all the digits precede all the lower case letters, or
           vice versa.
 
 
      Some implementations may generalize these procedures to take more
      than two arguments, as with the corresponding numerical predicates.
 
 
  -- library procedure: char-ci=? char1 char2
  -- library procedure: char-ci<? char1 char2
  -- library procedure: char-ci>? char1 char2
  -- library procedure: char-ci<=? char1 char2
  -- library procedure: char-ci>=? char1 char2
      These procedures are similar to `char=?' et cetera, but they treat
      upper case and lower case letters as the same.  For example,
      `(char-ci=? #\A #\a)' returns #t.  Some implementations may
      generalize these procedures to take more than two arguments, as
      with the corresponding numerical predicates.
 
 
  -- library procedure: char-alphabetic? char
  -- library procedure: char-numeric? char
  -- library procedure: char-whitespace? char
  -- library procedure: char-upper-case? letter
  -- library procedure: char-lower-case? letter
      These procedures return #t if their arguments are alphabetic,
      numeric, whitespace, upper case, or lower case characters,
      respectively, otherwise they return #f.  The following remarks,
      which are specific to the ASCII character set, are intended only
      as a guide:  The alphabetic characters are the 52 upper and lower
      case letters.  The numeric characters are the ten decimal digits.
      The whitespace characters are space, tab, line feed, form feed,
      and carriage return.
 
  -- procedure: char->integer char
  -- procedure: integer->char N
      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
 
 
  -- library procedure: char-upcase char
  -- library procedure: char-downcase char
      These procedures return a character CHAR2 such that `(char-ci=?
      CHAR CHAR2)'.  In addition, if CHAR is alphabetic, then the result
      of `char-upcase' is upper case and the result of `char-downcase'
      is lower case.
 
 
Info Catalog (r5rs.info.gz) Symbols (r5rs.info.gz) Other data types (r5rs.info.gz) Strings
automatically generated byinfo2html