Added python-style zip(), zip_long(), combinations() and permutations().

This commit is contained in:
Garth Minette
2021-03-10 14:49:39 -08:00
parent 50bd361119
commit 5b22e6f2d9
2 changed files with 98 additions and 19 deletions

View File

@@ -468,11 +468,11 @@ module test_triplet() {
test_triplet();
module test_permute() {
assert(permute([3,4,5,6]) == [[3,4],[3,5],[3,6],[4,5],[4,6],[5,6]]);
assert(permute([3,4,5,6],n=3) == [[3,4,5],[3,4,6],[3,5,6],[4,5,6]]);
module test_combinations() {
assert(combinations([3,4,5,6]) == [[3,4],[3,5],[3,6],[4,5],[4,6],[5,6]]);
assert(combinations([3,4,5,6],n=3) == [[3,4,5],[3,4,6],[3,5,6],[4,5,6]]);
}
test_permute();
test_combinations();
module test_repeat_entries() {