relates a term and one of its arguments.
arg/3 unifies Argument with the N-th argument of CompoundTerm.
N integer (between 1 and the arity of CompoundTerm) CompoundTerm compound term Argument term
| arg(1, f(a,b,c), X). | Succeeds with substitution X <- a. |
| arg(2, f(X, g((a,h(a,b))), g(a,Z)). | Succeeds with substitution Z <- h(a,b) |
| arg(3,f(a,b),X). | Fails. |
This predicate is part of the ISO-Prolog Standard.