====== Combinations without repeated ====== {{tag>combinatorics}} ===== Description ===== Program calculates combinations without repeated elements. **Source**: Guide to Prolog Programming (on-line tutorial) ===== Download ===== Program source code: {{combinations_without_repeated.pl}} ===== Listing ===== comb2(_,[]). comb2([X|T],[X|Comb]):-comb2(T,Comb). comb2([_|T],[X|Comb]):-comb2(T,[X|Comb]). % use ?-comb2([1,2,3,4],[X,Y]) to generate combinations with two elements. ===== Comments =====