Różnice

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

Odnośnik do tego porównania

pl:prolog:pllib:delete_element_2 [2019/06/27 15:50] (aktualna)
Linia 1: Linia 1:
 +====== Delete element 2 ======
 +{{tag>​lists}}
 +===== Description =====
 +Deleting elements from a list
 +
 +**Source**: ​ The Art of Prolog
 +===== Download =====
 +Program source code: {{delete_element_2.pl}}
 +===== Listing =====
 +<code prolog>
 +/*
 +   ​delete(Xs,​X,​Ys) :- 
 + Ys is the result of deleting all occurrences of X from the list Xs.
 +*/
 +     ​delete([X|Xs],​X,​Ys) :- !, delete(Xs,​X,​Ys).
 +     ​delete([X|Xs],​Z,​[X|Ys]) :- Y \== X, !, delete(Xs,​Z,​Ys).
 +     ​delete([],​X,​[]).
 +
 +%   ​Program 11.9a   ​Deleting elements from a list
 +</​code>​
 +===== Comments =====
  
pl/prolog/pllib/delete_element_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