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