Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bidirectional dictionary #104

Open
serenity4 opened this issue Jun 17, 2022 · 1 comment
Open

Bidirectional dictionary #104

serenity4 opened this issue Jun 17, 2022 · 1 comment

Comments

@serenity4
Copy link
Contributor

I have a use case which requires a bidirectional mapping (similar to Bijections), and wondered what would be preferred between either contributing such an implementation to Dictionaries or creating a new package. I personally don't have any particular opinion on that, hence me asking.

What I essentially seek to reuse is this source file with these tests. Do you think such functionality would belong here or in a separate package?

@andyferris
Copy link
Owner

That's a good question - I think either might be possible. If you just want something simple like you have done (with Dictionary inside) you could just make a small package.

I think here we could support a generic operation for "inverting" a mapping and have a wrapper type behaving like BijectiveMapping but supporting AbstractDictionary inside. An example of a dictionary type that's already bidirectional are the tokens dictionaries (keys are one-to-one with tokens) so it would be cool to be able to "invert" that sometimes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants