Różnice

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

Odnośnik do tego porównania

pl:prolog:pllib:term2list [2019/06/27 15:50] (aktualna)
Linia 1: Linia 1:
 +====== Term2list ======
 +{{tag>​lists}}
 +===== Description =====
 +Constructing a list corresponding to a term.
 +
 +**Source**: ​ The Art of Prolog
 +===== Download =====
 +Program source code: {{term2list.pl}}
 +===== Listing =====
 +<code prolog>
 +/*
 +   ​univ(Term,​ List) :- List is a list containing the functor of Term followed ​
 + by the arguments of Term.
 +*/
 +     ​univ(Term,​ [F|Args]) :-
 + functor(Term,​F,​N),​ args(0,​N,​Term,​Args).
 +
 +     ​args(I,​N,​Term,​Arg,​Args) :-
 + I < N, I1 is I+1, arg(I1,​Term,​Arg),​ args(I1,​N,​Term,​Args).
 +     ​args(N,​N,​Term,​[]).
 +
 +%  Program 9.5a   ​Constructing a list corresponding to a term
 +</​code>​
 +===== Comments =====
  
pl/prolog/pllib/term2list.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