Section "atom"
We make the content of a host language string, which is also our
datatype of a Prolog atom visible as a list of Unicode points. The
string encoding of the host language is made transpar-ent. The
built-ins do not expose the string encoding. This translates also
to the Prolog characters codes and atoms used by streams in the
next section.
There can be nevertheless differences among host languages. For
example we find differences in term_hash/2 for supplementary code
points that require surrogate pairs in UTF-16 encoding, whereas in
an UTF-32 encoding they only occupy one element. Further lexical
compare might give different results for private use area.
The following atom built-ins are provided:
- atom_codes(A, L): [ISO 8.16.5]
- If A is a variable, the built-in succeeds in A with the for
the Prolog list L. Otherwise the built-in succeeds in L with the
Prolog list from the atom A.
- char_code(C, N): [ISO 8.16.6]
- If C is a variable, the built-in succeeds in C with the
character for the code N. Otherwise the built-in succeeds in N
with the code from character C.
- atom_number(A, N):
- If A is a variable, then the built-in succeeds in A with the
atom for the Prolog number N. Otherwise the built-in succeeds in
N with the Prolog number from the atom A.
- atom_integer(A, R, N):
- If A is a variable, then the built-in succeeds in A with the
atom for the Prolog integer N in radix R. Otherwise the built-in
succeeds in N with the Prolog number from the atom A in radix R.
- atom_length(X, Y): [ISO 8.16.1]
- The predicate succeeds in Y with the length of the atom
X.atom_concat(X, Y, Z): [ISO 8.16.2]
The built-in succeeds when Z is the concatenation of X and Y.
- sub_atom(X, Y, Z, T, U): [ISO 8.16.3]
- The predicate succeeds whenever the atom U is the sub atom of
the atom X starting at position Y with length Z and ending T
characters before.
- last_sub_atom(X, Y, Z, T, U):
- The predicate succeeds whenever the atom U is the sub atom of
the atom X starting at position Y with length Z and ending T
characters before.
- atom_join(L, A):
- The built-in succeeds in A with the join of the atoms L.