georgematheos / GenWorldModels.jl

1 stars 0 forks source link

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

Open georgematheos opened 3 years ago

georgematheos commented 3 years ago

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 commented 3 years ago

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.