Expand description
Miscellaneous deterministic builtins: succ/2, plus/3,
unify_with_occurs_check/2, write/1, writeln/1, nl/0.
Ported byte-for-byte from patch-prolog v1 (solver.rs arms,
unify.rs occurs-check unifier). Notes:
succ/2both modes;succ(X, 0)fails; negatives raisedomain_error(not_less_than_zero, _); both-unbound raises instantiation.plus/3supports the three integer modes (any one argument unbound); fewer than two bound raises instantiation.unify_with_occurs_check/2uses a LOCAL occurs-checking unifier (iterative; does not touch the sharedunify.rs).write/1/writeln/1use v1’sterm_to_string(infix operators,[a, b]lists, floats via{}), printed immediately.writeadds no newline;writelnandnladd one.
Functions§
- plg_
rt_ b_ nl_ 0 nl/0: print a newline. Always succeeds.- plg_
rt_ b_ plus_ 3 plus/3:Z = X + Yover integers; any single unbound is solved for.- plg_
rt_ b_ succ_ 2 succ/2:S = X + 1over non-negative integers, both modes.- plg_
rt_ b_ unify_ with_ occurs_ check_ 2 unify_with_occurs_check/2: like=/2but fails rather than build a cyclic term. Local iterative implementation — bindings are trailed so the caller’s choice-point rewind undoes a partial unification.- plg_
rt_ b_ write_ 1 write/1: print the term (v1term_to_string), no trailing newline.- plg_
rt_ b_ writeln_ 1 writeln/1:write/1followed by a newline.