Expand description
Term-introspection builtins: functor/3, arg/3, =../2 (univ),
copy_term/2.
Ported byte-for-byte from patch-prolog v1 (solver.rs Functor/Arg/
Univ/CopyTerm arms). Tag decisions verified against the oracle:
functor(T, '.', 2)andT =.. ['.', a, b]both build a STR (functor “.”, arity 2), NOT a list cell — v1 always constructsTerm::Compound.- decomposing a
TAG_LSTyields functor./ arity 2 and args [Head, Tail] (univ produces['.', H, T]). - errors mirror v1’s structured balls (see the captured oracle 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 oforigwith 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.