Bind - sellout/data-structure-zoo GitHub Wiki
Available in finite maps, bind
adds a new key-value pairing. bind!
is the mutating version.
m = finite-map.empty;
lookup "foo" m;
⇒ error: not found
m2 = bind "foo" "bar" m;
lookup "foo" m2
⇒ "bar"
lookup "foo" m;
⇒ error: not found
bind! "foo" "baz" m;
lookup "foo" m;
⇒ "baz"
data structure performance
- hash array mapped trie – pure – O(1)
- hash table – mutating – O(1)