arg/3 meta-logical

Synopsis

arg(+ArgNum, +Term, -Arg)

unifies Arg with the ArgNumth argument of term Term.

Arguments


ArgNum integer
positive integer
Term nonvar
compound term
Arg term

Description

The arguments are numbered from 1 upwards.

Exceptions


instantiation_error
if ArgNum or Term is unbound.
type_error
if ArgNum is not an integer.

Example

     | ?- arg(2, foo(a,b,c), X).
     
     X = b
     

See Also

functor/3, =../2 ref-lte-act, lib-tma-arg