====== Select ====== {{tag>lists}} ===== Description ===== Selecting an element from a list **Source**: The Art of Prolog ===== Download ===== Program source code: {{select.pl}} ===== Listing ===== /* select(X,HasXs,OneLessXs) :- The list OneLessXs is the result of removing one occurrence of X from the list HasXs. */ select(X,[X|Xs],Xs). select(X,[Y|Ys],[Y|Zs]) :- select(X,Ys,Zs). % Program 3.19: Selecting an element from a list ===== Comments =====