Różnice

Różnice między wybraną wersją a wersją aktualną.

Odnośnik do tego porównania

pl:prolog:pllib:subterm_2 [2019/06/27 15:50]
pl:prolog:pllib:subterm_2 [2019/06/27 15:50] (aktualna)
Linia 1: Linia 1:
 +====== Subterm 2 ======
 +{{tag>​function}}
 +===== Description =====
 +Subterm defined using univ
 +
 +**Source**: ​ The Art of Prolog
 +===== Download =====
 +Program source code: {{subterm_2.pl}}
 +===== Listing =====
 +<code prolog>
 +/*
 +   ​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
 +</​code>​
 +===== Comments =====
  
pl/prolog/pllib/subterm_2.txt · ostatnio zmienione: 2019/06/27 15:50 (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