iter.permutations() generates duplicated combinations
sunnylcw opened this issue · comments
sunnylcw commented
VSL version: 0.1.45
OS: Windows 11 Pro 21H2 22000.318
What did you do?
Generated combinations with iter.permutations()
What did you expect to see?
An array of unique combinations
What did you see instead?
An array with some duplicated combinations
Code to reproduce the issue:
import vsl.iter
combinations := iter.permutations([f64(0), 1, 2], 3)
println('combinations: $combinations\n')
// check for duplicates
mut combination_count := map[string]int{}
for combination in combinations {
combination_count[combination.str()]++
}
println('duplicates:')
for k, v in combination_count {
if v > 1 {
println('$k: $v')
}
}
Ulises Jeremias commented
hey! thank for creating this issue! I'll keep you updated with the status of this issue!