Character Codes

The following operation is included in order to allow integer arithmetic on character codes.


[X]
Evaluates to X for numeric X. This is relevant because character strings in Prolog are lists of character codes, that is, integers. Thus, for those integers that correspond to character codes, the user can write a string of one character in place of that integer in an arithmetic expression. For example, the expression (A) is equivalent to (B), which in turn becomes (C) in which case X is unified with 2:
          X is "c" - "a" (A)
          
          X is [99] - [97] (B)
          
          X is 99 - 97 (C)
          

A cleaner way to do the same thing is

          X is 0'c - 0'a