For convenience, a further notational variant is allowed for lists of integers that correspond to character codes. Lists written in this notation are called strings. E.g.:
which, by default, denotes exactly the same list as
The Prolog flag
double_quotes can be used to change the way
strings are interpreted. The default value of the flag is
which implies the above interpretation. If the flag is set to
chars, a string is transformed to a list of character atoms. E.g. with
this setting the above string represents the list:
double_quotes has the value
string is made equivalent to the atom formed from its characters:
the above sample string is then the same as the atom
Please note: Most code assumes that the Prolog flag
double_quotes has its default value (
codes). Changing this
flag is not recommended.
Backslashes in the sequence denote escape sequences
(see ref-syn-syn-esc). As for quoted atoms, if a double quote
character is included in the sequence it must be escaped, e.g.
The built-in predicates that print terms (see ref-iou-tou) don’t use string syntax even if they could.
The characters that are allowed to occur within double quotes are restricted to a subset of Unicode; see ref-syn-syn-tok.