Closed uwiger closed 9 years ago
Disregard my previous comment, I understand now, I think. If this is the case, why not use ordsets:subtract/2
at the bottom of that function instead of --
?
You could, of course, but since the ordsets module has a defined representation (ordered lists with no duplicates), I felt that the line using '--' could remain. But it's your code - you decide. :)
It's just a nitpick, not significant.
:+1: 8fec121
@borshop merge
The fold function in apply_mappings() would simply cons mappings to lists for either dropping or keeping a mapping, and then subtracting the two. The effect was, in a sense, a majority vote: if more mappings than not indicated dropping, the translation would be dropped, counter-intuitively.
Solution: make the accumulators ordsets instead. Two test cases were added: one with 1 'good mapping' and 1 'bad', and the other with 1 'good' and 2 'bad'. The second test failed before the fix:
After the fix: