diff options
Diffstat (limited to 'src/couch_tests/src/couch_tests_combinatorics.erl')
-rw-r--r-- | src/couch_tests/src/couch_tests_combinatorics.erl | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/couch_tests/src/couch_tests_combinatorics.erl b/src/couch_tests/src/couch_tests_combinatorics.erl index 343336277..f1ee6dd2e 100644 --- a/src/couch_tests/src/couch_tests_combinatorics.erl +++ b/src/couch_tests/src/couch_tests_combinatorics.erl @@ -65,7 +65,7 @@ powerset(X, [H | T], Acc) -> permutations([]) -> [[]]; -permutations(L) -> +permutations(L) -> [[H | T] || H <- L, T <- permutations(L -- [H])]. %% @doc product({Items1, Items2, ..., ItemsN}) @@ -83,7 +83,7 @@ permutations(L) -> %% ] -spec product(Elements :: list()) -> [list()]. -product([H]) -> +product([H]) -> [[A] || A <- H]; product([H | T]) -> [[A | B] || A <- H, B <- product(T)]. @@ -109,7 +109,6 @@ product([H | T]) -> binary_combinations(NBits) -> product(lists:duplicate(NBits, [true, false])). - %% @doc combinations(N, Items). %% Generate all combinations by choosing N values from a given list of Items %% in sorted order. Each combination is sorted and the entire table is sorted. |