Squash bug duplication by moving the clever mass-union and mass-
intersection gimmicks into their own functions with their own test suite. This turned up two bugs: 1. The mass weighted union gimmick was incorrect when passed a list with a single mapping. In that case, it neglected to multiply the mapping by the given weight. 2. The underlying weighted{Intersection, Union} code does something crazy if you pass it weights less than 0. I had vaguely hoped to be able to subtract scores by passing 1 and -1 as weights, but this doesn't work. It's hard to say exactly what it does then. The line weightedUnion(IIBTree(), mapping, 1, -2) seems to return a mapping with the same keys, but *all* of whose values are -2, regardless of the original mapping's values.
Showing
Please register or sign in to comment