-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Add map delete, put, fetch type operations #13795
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
Conversation
end | ||
end | ||
|
||
def map_update_static_value(descr, key, type) do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
def map_update_static_value(descr, key, type) do | |
defp map_update_static_value(descr, key, type) do |
end | ||
end | ||
|
||
def map_put_static_value(descr, key, type) do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
def map_put_static_value(descr, key, type) do | |
defp map_put_static_value(descr, key, type) do |
end | ||
|
||
# Directly inserts a key of a given type into every positive and negative map | ||
def map_put_static(descr, key, type) do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
def map_put_static(descr, key, type) do | |
defp map_put_static(descr, key, type) do |
case :maps.take(:dynamic, descr) do | ||
:error -> | ||
cond do | ||
subtype?(descr, open_map([{key, term()}])) -> map_put_static(descr, key, type) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a more efficient way of checking this? Perhaps we could use map_fetch
? Perhaps we could simplify this function with map_fetch
?
💚 💙 💜 💛 ❤️ |
Add map_delete, map_fetch, map_put operations for map types
Rework function map_split_on_key into two direct functions map_get and map_delete
Add an optimization for map_difference.
If we are doing the difference of an open map with a single key, we can directly compute the difference of that key in both maps to simplify the result.
Also, added the possibility for map keys to be
not_set()
since it is used inmap_delete
.