dictionaries
model
- a dictionary is a table that associates keys with values
- each key is associated with at most one value
constructors
- new: –> Dict
- add: Dict x Key x Val –> Dict
observers
- containsKey: Dict x Key –> Bool
- lookup: Dict x Key –> Val
contract
- (containsKey (new) k) ==> #f
- (containsKey (add d k1 v) k2) ==> #t when k1 = k2, or whatever (containsKey d k2 v) evals to otherwise
- (lookup (add d k1 v) k2) ==> v when k1 = k2, or whatever (lookup d k2 v) evals to otherwise
- assume lookup is only called when dict contains keyand add is only called with keys not contained in dict