====== Variation ====== {{tag>combinatorics lists}} ===== Description ===== Program create variation without repeated list elements **Source**: Guide to Prolog Programming (on-line tutorial) ===== Download ===== Program source code: {{variation.pl}} ===== Listing ===== varia(0,_,[]). varia(N,L,[H|Varia]):-N>0,N1 is N-1,delete(H,L,Rest),varia(N1,Rest,Varia). delete(X,[X|T],T). delete(X,[H|T],[H|NT]):-delete(X,T,NT). ===== Comments =====