Availability:built-in
[ISO]arg(?Arg,
+Term, ?Value)Term should be instantiated to a term, Arg to an
integer between 1 and the arity of Term. Value is
unified with the
Arg-th argument of Term. Arg may also
be unbound. In this case Value will be unified with the
successive arguments of the term. On successful unification, Arg
is unified with the argument number. Backtracking yields alternative
solutions.116The instantiation
pattern (-, +, ?) is an extension to‘standard’Prolog. Some
systems provide genarg/3 that covers this pattern. The
predicate arg/3
fails silently if Arg = 0 or
Arg > arity and raises the exception
domain_error(not_less_than_zero, Arg)
if Arg
< 0.