IF Computer > MINERVA > Manual > Reference > Predicates > Term creation and decomposition > arg/3

arg/3

MINERVA
ifcomputer logo
f
Expert Services on the Web

relates a term and one of its arguments.

arg(+N, +CompoundTerm, -Argument)

arg/3 unifies Argument with the N-th argument of CompoundTerm.

Arguments

N                      integer (between 1 and the arity of CompoundTerm)
CompoundTerm           compound term
Argument               term

Examples

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.

Standard

This predicate is part of the ISO-Prolog Standard.

See also

copy_term/2, functor/3, '=..'/2.

document: http://www.ifcomputer.co.jp/MINERVA/Manual/Reference/Predicates/term_creat_decomp/arg/print_en.html
published 2008/9/1 update 1998/8/11 (c) 1996-2006 IF Computer Japan
IF Computer 5-28-2 Sendagi, Bunkyo-ku Tel +81-3-5814-3352 start (AT) ifcomputer.com
Customer Support Tokyo 113-0022 Japan   http://www.ifcomputer.com
Back> managed with ubiCMS