atom_integers(+atom, ?ascii_code_list)
atom_integers(-atom, +ascii_code_list)

An atom name and a list of integers are unified. If the first argument is an atom then it is decomposed into a list of integers and that list is unified with the second argument. The integers are the ASCII values of the characters of the atom

If the first argument is a variable then atom_integers/2 tries to create an atom from the list of integers of the right argument and unify the new atom it created with the first argument.

see also: atom_base64/2 atom_compress/2 atom_concat/3 atom_encrypt/3 atom_final_md5/1 atom_length/2 atom_reset_md5/0 atom_update_md5/1 char_code/2 number_chars/2 number_codes/2 number_integers/2 sub_atom/5

Example
atom_integers('peter', L). L=[112, 101, 116, 101, 114] is the output
atom_integers('pet', [112|T]). after unification the variable T has the value [101, 116]
atom_integers(A, [112, 101]). A is unified with the value 'pe'

 

Exceptions  
Atom is neither a variable nor an atom a type_error(atom, Atom) exception is thrown
Atom is a variable and List is a variable or a partial List or a list with a variable as element an instantiation_error exception is thrown
Atom is a variable and List is neither a variable nor a partial list nor a list a type_error(list, List) exception is thrown
Atom is a variable and an element E of the list is neither a variable nor a character code a type_error(integer, E) exception is thrown

 

 

info@trinc-prolog.com