Różnice

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

Odnośnik do tego porównania

pl:prolog:pllib:subterm [2019/06/27 15:50] (aktualna)
Linia 1: Linia 1:
 +====== Subterm ======
 +{{tag>​function}}
 +===== Description =====
 +Finding subterms of a term
 +
 +**Source**: ​ The Art of Prolog
 +===== Download =====
 +Program source code: {{subterm.pl}}
 +===== Listing =====
 +<code prolog>
 +/*
 +   ​subterm(Sub,​Term) :- Sub is a subterm of the ground term Term.
 +*/
 +     ​subterm(Term,​Term).
 +     ​subterm(Sub,​Term) :- 
 +        compound(Term),​ functor(Term,​F,​N),​ subterm(N,​Sub,​Term).
 +
 +     ​subterm(N,​Sub,​Term) :- 
 +        N > 1, N1 is N-1, subterm(N1,​Sub,​Term).
 +     ​subterm(N,​Sub,​Term) :- 
 +        arg(N,​Term,​Arg),​ subterm(Sub,​Arg).
 +
 +%  Program 9.2    Finding subterms of a term
 +</​code>​
 +===== Comments =====
  
pl/prolog/pllib/subterm.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