Subterm 2

Description

Subterm defined using univ

Source: The Art of Prolog

Download

Program source code: subterm_2.pl

Listing

/*
   subterm(Sub,Term) :- Sub is a subterm of the ground term Term.
*/
     subterm(Term,Term).
     subterm(Sub,Term) :- 
        compound(Term), Term =.. [F|Args], subterm_list(Sub,Args).
 
     subterm_list(Sub,[Arg|Args]) :- 
        subterm(Sub,Arg).
     subterm_list(Sub,[Arg|Args]) :-
	subterm_list(Sub,Args).
 
%  Program 9.4   Subterm defined using univ

Comments

pl/prolog/pllib/subterm_2.txt · ostatnio zmienione: 2017/07/17 08:08 (edycja zewnętrzna)
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0