Author(s): The CLIP Group.
Version: 1.11#222 (2004/5/24, 13:8:7 CEST)
Version of last change: 1.11#169 (2004/2/3, 21:36:40 CET)
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.
atomic_basic
)atomic_basic
)
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.
General properties:
name(Const,String)
is side-effect free
.
(basic_props:sideff/2
)
This predicate is understood natively by CiaoPP.
(basic_props:native/1
)
Usage 1:
String
is a string (a list of character codes).
(basic_props:string/1
)
Const
is an atomic term (an atom or a number).
(basic_props:constant/1
)
String
is a string (a list of character codes).
(basic_props:string/1
)
basic_props:eval(name(Const,String))
(basic_props:eval/1
)
Usage 2:
String
can be interpreted as a number, Const
is unified with that number, otherwise with the atom whose name is String
.
Const
is a free variable.
(term_typing:var/1
)
String
is a string (a list of character codes).
(basic_props:string/1
)
Const
is an atomic term (an atom or a number).
(basic_props:constant/1
)
basic_props:eval(name(Const,String))
(basic_props:eval/1
)
atom_codes(Atom, String)
* ISO *
String
is the list of the ASCII codes of the characters comprising the name of Atom
.
General properties:
atom_codes(Atom,String)
is side-effect free
.
(basic_props:sideff/2
)
This predicate is understood natively by CiaoPP.
(basic_props:native/1
)
Usage 1:
String
is a string (a list of character codes).
(basic_props:string/1
)
Atom
is an atom.
(basic_props:atm/1
)
String
is a string (a list of character codes).
(basic_props:string/1
)
basic_props:eval(atom_codes(Atom,String))
(basic_props:eval/1
)
Usage 2:
Atom
is a free variable.
(term_typing:var/1
)
String
is a string (a list of character codes).
(basic_props:string/1
)
Atom
is an atom.
(basic_props:atm/1
)
basic_props:eval(atom_codes(Atom,String))
(basic_props:eval/1
)
number_codes(Number, String)
* ISO *
String
is the list of the ASCII codes of the characters comprising a representation of Number
.
General properties:
number_codes(Number,String)
is side-effect free
.
(basic_props:sideff/2
)
This predicate is understood natively by CiaoPP.
(basic_props:native/1
)
Usage 1:
String
is a string (a list of character codes).
(basic_props:string/1
)
Number
is a number.
(basic_props:num/1
)
String
is a string (a list of character codes).
(basic_props:string/1
)
basic_props:eval(number_codes(Number,String))
(basic_props:eval/1
)
Usage 2:
Number
is a free variable.
(term_typing:var/1
)
String
is a string (a list of character codes).
(basic_props:string/1
)
Number
is a number.
(basic_props:num/1
)
basic_props:eval(number_codes(Number,String))
(basic_props:eval/1
)
number_codes(Number, String, Base)
String
is the list of the ASCII codes of the characters comprising a representation of Number
in base Base
.
General properties:
number_codes(Number,String,Base)
is side-effect free
.
(basic_props:sideff/2
)
This predicate is understood natively by CiaoPP.
(basic_props:native/1
)
Usage 1:
Base
is a string (a list of character codes).
(basic_props:string/1
)
Number
is a number.
(basic_props:num/1
)
String
is an integer.
(basic_props:int/1
)
Base
is a string (a list of character codes).
(basic_props:string/1
)
basic_props:eval(number_codes(Number,String,Base))
(basic_props:eval/1
)
Usage 2:
Number
is a free variable.
(term_typing:var/1
)
String
is an integer.
(basic_props:int/1
)
Base
is a string (a list of character codes).
(basic_props:string/1
)
Number
is a number.
(basic_props:num/1
)
basic_props:eval(number_codes(Number,String,Base))
(basic_props:eval/1
)
atom_number(Atom, Number)
Atom
can be read as a representation of Number
.
General properties:
atom_number(Atom,Number)
is side-effect free
.
(basic_props:sideff/2
)
This predicate is understood natively by CiaoPP.
(basic_props:native/1
)
Usage 1:
Number
is a number.
(basic_props:num/1
)
Atom
is an atom.
(basic_props:atm/1
)
Number
is a number.
(basic_props:num/1
)
basic_props:eval(atom_number(Atom,Number))
(basic_props:eval/1
)
Usage 2:
Atom
is a free variable.
(term_typing:var/1
)
Number
is a number.
(basic_props:num/1
)
Atom
is an atom.
(basic_props:atm/1
)
basic_props:eval(atom_number(Atom,Number))
(basic_props:eval/1
)
atom_length(Atom, Length)
* ISO *
Length
is the number of characters forming the name of Atom
.
General properties:
atom_length(Atom,Length)
is side-effect free
.
(basic_props:sideff/2
)
This predicate is understood natively by CiaoPP.
(basic_props:native/1
)
Usage:
Length
is an integer.
(basic_props:int/1
)
Atom
is an atom.
(basic_props:atm/1
)
Length
is an integer.
(basic_props:int/1
)
basic_props:eval(atom_length(Atom,Length))
(basic_props:eval/1
)
atom_concat(Atom_1, Atom_2, Atom_12)
* ISO *
Atom_12
is the result of concatenating Atom_1
followed by Atom_2
.
General properties:
atom_concat(Atom_1,Atom_2,Atom_12)
is side-effect free
.
(basic_props:sideff/2
)
This predicate is understood natively by CiaoPP.
(basic_props:native/1
)
Usage 1:
Atom_12
is currently instantiated to an atom.
(term_typing:atom/1
)
Atom_1
is currently instantiated to an atom.
(term_typing:atom/1
)
Atom_2
is currently instantiated to an atom.
(term_typing:atom/1
)
Atom_12
is currently instantiated to an atom.
(term_typing:atom/1
)
basic_props:eval(atom_concat(Atom_1,Atom_2,Atom_12))
(basic_props:eval/1
)
Usage 2:
Atom_1
is a free variable.
(term_typing:var/1
)
Atom_2
is a free variable.
(term_typing:var/1
)
Atom_12
is currently instantiated to an atom.
(term_typing:atom/1
)
Atom_1
is currently instantiated to an atom.
(term_typing:atom/1
)
Atom_2
is currently instantiated to an atom.
(term_typing:atom/1
)
basic_props:eval(atom_concat(Atom_1,Atom_2,Atom_12))
(basic_props:eval/1
)
Usage 3:
Atom_1
is a free variable.
(term_typing:var/1
)
Atom_2
is currently instantiated to an atom.
(term_typing:atom/1
)
Atom_12
is currently instantiated to an atom.
(term_typing:atom/1
)
Atom_1
is currently instantiated to an atom.
(term_typing:atom/1
)
basic_props:eval(atom_concat(Atom_1,Atom_2,Atom_12))
(basic_props:eval/1
)
Usage 4:
Atom_1
is currently instantiated to an atom.
(term_typing:atom/1
)
Atom_2
is a free variable.
(term_typing:var/1
)
Atom_12
is currently instantiated to an atom.
(term_typing:atom/1
)
Atom_2
is currently instantiated to an atom.
(term_typing:atom/1
)
basic_props:eval(atom_concat(Atom_1,Atom_2,Atom_12))
(basic_props:eval/1
)
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.
General properties:
sub_atom(Atom,Before,Length,Sub_atom)
is side-effect free
.
(basic_props:sideff/2
)
This predicate is understood natively by CiaoPP.
(basic_props:native/1
)
Usage:
Sub_atom
is an atom.
(basic_props:atm/1
)
Atom
is an atom.
(basic_props:atm/1
)
Before
is an integer.
(basic_props:int/1
)
Length
is an integer.
(basic_props:int/1
)
Sub_atom
is an atom.
(basic_props:atm/1
)
basic_props:eval(sub_atom(Atom,Before,Length,Sub_atom))
(basic_props:eval/1
)
Go to the first, previous, next, last section, table of contents.