Skip to main content

Module atomops

Module atomops 

Source
Expand description

Atom/number-string builtins: atom_length/2, atom_concat/3, atom_chars/2, number_chars/2, number_codes/2.

Ported byte-for-byte from patch-prolog v1 (solver.rs arms). Modes verified against the oracle:

  • atom_concat/3 supports ONLY the deterministic both-atoms-bound mode; an unbound prefix/suffix raises type_error(atom, _) (v1 is not nondeterministic here).
  • atom_chars/2 works both directions (atom→one-char atoms, list→atom).
  • number_chars/2 and number_codes/2 work both directions; garbage input on the reverse direction raises a bare syntax_error formal.
  • float→chars/codes uses v1’s format_float (“3.0”, not “3”).

Functions§

plg_rt_b_atom_chars_2
atom_chars/2: both directions (atom ↔ list of one-char atoms).
plg_rt_b_atom_concat_3
atom_concat/3: concatenate two bound atoms. Only this mode is supported (v1 raises a type error otherwise).
plg_rt_b_atom_length_2
atom_length/2: length (in chars) of an atom. 1 = success.
plg_rt_b_number_chars_2
number_chars/2: both directions (number ↔ list of one-char atoms).
plg_rt_b_number_codes_2
number_codes/2: both directions (number ↔ list of char codes).