Or maybe reciprocal dict - not sure what the right name for this is, but wondering if such a data structure exists in a package somewhere. Basically, I'd like a dictionary-like structure, where all entries are reciprocal. That is,
I'd like to do something like:
md = MirrorDict('a'=>'b', 'c'=>'d')
md['a'] # 'b'
md['b'] # 'a'
md['d'] = 'e'
md['e'] # 'd'
md['c'] # key error
https://github.com/scheinerman/Bijections.jl/blob/master/README.md
Take note of the "active_inv" it can provide.
Last updated: Nov 06 2024 at 04:40 UTC