====== Ground term ====== {{tag>terms}} ===== Description ===== Testing if a term is ground. **Source**: The Art of Prolog ===== Download ===== Program source code: {{ground_term.pl}} ===== Listing ===== /* myground(Term) :- Term is a ground term. */ myground(Term) :- nonvar(Term), constant(Term). myground(Term) :- nonvar(Term), compound(Term), functor(Term,F,N), myground(N,Term). myground(N,Term) :- N > 0, arg(N,Term,Arg), myground(Arg), N1 is N-1, myground(N1,Term). myground(0,Term). % Program 10.4 Testing if a term is ground ===== Comments =====