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

Dictionary constructed with one dictionary of keys and one of values #44

Open
georgematheos opened this issue Nov 25, 2020 · 1 comment

Comments

@georgematheos
Copy link
Owner

I think it may be useful to implement a deterministic generative function which takes in 2 dictionaries a and b with the same set of keys, and returns a dictionary mapping from a[k] => b[k] for each key in a/b.

The idea would be to enable things like:

objects ~ get_object_set(...)
vals ~ dictmap_lookup_or_generate(world[:val], lazy_set_to_dict_map(identity, objects))
indices ~ dictmap_lookup_or_generate(world[:index], lazy_set_to_dict_map(identity, objects))
idx_to_val ~ dict_from_keyval_dict(indices, vals)
@georgematheos
Copy link
Owner Author

By the same token, it might be useful to have a mechanism like get_object_vector which gets objects in order, for situations where we actually care about the indices of objects.

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

1 participant