Get the value for a key03.01
Get hashes the key, walks that bucket, and returns the stored value if the key is present. It does not scan other keys. It does not search by value.
get(1) on {4:2, 1:8, 9:3} is 8. Presence is about the key 1, not about whether 8 appears as a value elsewhere.
Same skill, three traces. Read all three before you try it.
01hit - given
a = [4, 1, 9]as{4:2,1:8,9:3}, get1- walk
key
1present- result
8
02only key - given
a = [7]as{7:3}, get7- walk
the one entry
- result
3
03empty - given
a = [], get4- walk
no keys
- result
- miss
get(m, k).m is the hash map. k is a key that exists.Return the value stored for
k. Do not search by value.a = [4, 1, 9] as {4:2,1:8,9:3}, get 1 → 8.a = [7] as {7:3}, get 7 → 3.a = [], get 4 → miss.constraintskeys are integers. The key exists when you get.
Every Check with Awel is frozen here. Open one to read the code or load it back into the editor.