findWithDefault -package:compdata

The expression (findWithDefault def k map) returns the value at key k or returns def when the key is not an element of the map.
findWithDefault 'x' 1 (fromList [(5,'a'), (3,'b')]) == 'x'
findWithDefault 'x' 5 (fromList [(5,'a'), (3,'b')]) == 'a'
The expression (findWithDefault def k map) returns the value at key k or returns default value def when the key is not in the map.
findWithDefault 'x' 1 (fromList [(5,'a'), (3,'b')]) == 'x'
findWithDefault 'x' 5 (fromList [(5,'a'), (3,'b')]) == 'a'
Return the value to which the specified key is mapped, or the default value if this map contains no mapping for the key.
The expression (findWithDefault def k map) returns the value at key k or returns def when the key is not an element of the map.
findWithDefault 'x' 1 (fromList [(5,'a'), (3,'b')]) == 'x'
findWithDefault 'x' 5 (fromList [(5,'a'), (3,'b')]) == 'a'
O(log n). The expression (findWithDefault def k map) returns the value at key k or returns default value def when the key is not in the map.
findWithDefault 'x' 1 (fromList [(5,'a'), (3,'b')]) == 'x'
findWithDefault 'x' 5 (fromList [(5,'a'), (3,'b')]) == 'a'
Like lookup, but uses a default value when the key does not exist in the map.
O(log n). The expression (findWithDefault def k map) returns the value at key k or returns default value def when the key is not in the map.
findWithDefault d k m returns the value bound to k in the map m, or d if k is not bound in the map.
O(log n). The expression (findWithDefault def k map) returns the value at key k or returns default value def when the key is not in the map.
O(log n). The expression (findWithDefault def k map) returns the value at key k or returns default value def when the key is not in the map.
The expression (findWithDefault def k map) returns the value at key k or returns def when the key is not an element of the map.
O(log n). The expression (findWithDefault def k map) returns the value at key k or returns default value def when the key is not in the map.
findWithDefault 'x' 1 (fromList ((5,'a') :| [(3,'b')])) == 'x'
findWithDefault 'x' 5 (fromList ((5,'a') :| [(3,'b')])) == 'a'
O(log n). The expression (findWithDefault def k map) returns the value at key k or returns default value def when the key is not in the map.
findWithDefault 'x' 1 (fromList ((5,'a') :| [(3,'b')])) == 'x'
findWithDefault 'x' 5 (fromList ((5,'a') :| [(3,'b')])) == 'a'
The expression (findWithDefault def k map) returns the value at key k or returns default value def when the key is not in the map.
O(log n). The expression (findWithDefault def k map) returns the value at key k or returns default value def when the key is not in the map.
O(log n). The expression (findWithDefault def k map) returns the value at key k or returns default value def when the key is not in the map.
findWithDefault 'x' 1 (fromList [(5,'a'), (3,'b')]) == 'x'
findWithDefault 'x' 5 (fromList [(5,'a'), (3,'b')]) == 'a'
O(1) in the best case, O(n) in the worst case. The expression findWithDefault ht def k returns the value at key k or returns default value def when the key is not in the dictionary.
Lookup a value in the tree, or return a default.