Go to the first, previous, next, last section, table of contents.


Basic predicates handling names of constants

Author(s): The CLIP Group.

Version: 1.10#6 (2004/8/7, 21:46:39 CEST)

Version of last change: 1.9#334 (2004/4/13, 13:28:2 CEST)

The Ciao system provides builtin predicates which allow dealing with names of constants (atoms or numbers). Note that sometimes strings (character code lists) are more suitable to handle sequences of characters.

Usage and interface (atomic_basic)

Documentation on exports (atomic_basic)

PREDICATE: name/2:

name(Const, String)

String is the list of the ASCII codes of the characters comprising the name of Const. Note that if Const is an atom whose name can be interpreted as a number (e.g. '96'), the predicate is not reversible, as that atom will not be constructed when Const is uninstantiated. Thus it is recommended that new programs use the ISO-compliant predicates atom_codes/2 or number_codes/2, as these predicates do not have this inconsistency.

Usage 1: name(+constant, ?string)

Usage 2: name(-constant, +string)

PREDICATE: atom_codes/2:

atom_codes(Atom, String)

String is the list of the ASCII codes of the characters comprising the name of Atom.

Usage 1: atom_codes(+atm, ?string) * ISO *

Usage 2: atom_codes(-atm, +string) * ISO *

PREDICATE: number_codes/2:

number_codes(Number, String)

String is the list of the ASCII codes of the characters comprising a representation of Number.

Usage 1: number_codes(+num, ?string) * ISO *

Usage 2: number_codes(-num, +string) * ISO *

PREDICATE: number_codes/3:

number_codes(Number, Base, String)

String is the list of the ASCII codes of the characters comprising a representation of Number in base Base.

Usage 1: number_codes(+num, +int, ?string)

Usage 2: number_codes(-num, +int, +string)

PREDICATE: atom_number/2:

atom_number(Atom, Number)

Atom can be read as a representation of Number.

Usage 1: atom_number(+atm, ?num)

Usage 2: atom_number(-atm, +num)

PREDICATE: atom_length/2:

atom_length(Atom, Length)

Length is the number of characters forming the name of Atom.

Usage: atom_length(+atm, ?int) * ISO *

PREDICATE: atom_concat/3:

atom_concat(Atom_1, Atom_2, Atom_12)

Atom_12 is the result of concatenating Atom_1 followed by Atom_2.

Usage 1: atom_concat(+atom, +atom, ?atom) * ISO *

Usage 2: atom_concat(-atom, -atom, +atom) * ISO *

Usage 3: atom_concat(-atom, +atom, +atom) * ISO *

Usage 4: atom_concat(+atom, -atom, +atom) * ISO *

PREDICATE: sub_atom/4:

sub_atom(Atom, Before, Length, Sub_atom)

Sub_atom is formed with Length consecutive characters of Atom after the Before character. For example, the goal sub_atom(summer,1,4,umme) succeeds.

Usage: sub_atom(+atm, +int, +int, ?atm)


Go to the first, previous, next, last section, table of contents.