
21 Aug
2007
21 Aug
'07
9:37 a.m.
Hugh Perkins wrote:
Exactly. For this to work there needs to be the constraint that there's a one-to-one mapping in each direction. The Bimap should have the uniqueness promise that "Set (k, v)" gives. Yet you should be able to search on either tuple value.
Or... have the possibility of returning a list of values.
Arguably there are two possible implementations, one that enforces one-to-one mapping, and one which allows multiple values, in either direction.
Terminology reminder :) - the latter is called "(binary) relation" http://en.wikipedia.org/wiki/Binary_relation - the former would be a "bijection" http://en.wikipedia.org/wiki/Bijective_map Regards, apfelmus