This repository has been archived on 2025-09-23. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
2025LogProg-project-GhentPr.../examples/meta/ground.pl

15 lines
238 B
Prolog

ground(T) :-
nonvar(T), atomic(T),
!.
ground(T) :-
nonvar(T), compound(T),
functor(T, _, N),
ground(T, N).
ground(T, N) :-
N \== 0,
arg(N, T, A),
ground(A),
M is N - 1,
ground(T, M).
ground(T, 0).