Availability:Arithmetic function (see is/2)
[deprecated].(+Char,[])A list of one element evaluates to the character code of this element.127The
function is documented as .
/2
. Using
SWI-Prolog v7 and later the actual functor is [|]
/2
.
This implies "a"
evaluates to the character code of the
letter‘a’(97) using the traditional mapping of double quoted
string to a list of character codes. Char is either a valid
code point (non-negative integer up to the Prolog flag max_char_code)
or a one-character atom. Arithmetic evaluation also translates a string
object (see section 5.2)
of one character length into the character code for that character. This
implies that expression "a"
works if the Prolog flag double_quotes
is set to one of
codes
, chars
or string
.
Getting access to character codes this way originates from DEC10
Prolog. ISO has the 0'
syntax and the predicate char_code/2.
Future versions may drop support for X is "a"
.