Skip to main content

Module termops

Module termops 

Source
Expand description

Term-introspection builtins: functor/3, arg/3, =../2 (univ), copy_term/2.

Tag decisions:

  • functor(T, '.', 2) and T =.. ['.', a, b] both build a STR (functor “.”, arity 2), NOT a list cell.
  • decomposing a TAG_LST yields functor . / arity 2 and args [Head, Tail] (univ produces ['.', H, T]).
  • errors are structured balls (see the captured strings in the unit tests).

Functions§

plg_rt_b_arg_3
arg/3: the N-th argument of a compound. 1 = success, 0 = fail/error.
plg_rt_b_copy_term_2
copy_term/2: a fresh copy of orig with consistent renamed vars.
plg_rt_b_functor_3
functor/3: decompose or construct. 1 = success, 0 = failure/error.
plg_rt_b_univ_2
=../2 (univ): decompose into / build from a list. 1 = success.