Int -> CInt
List index (subscript) operator, starting from 0. It is an instance of the more general Data.List.genericIndex, which takes an index of any integral type.
O(log(min(i,n-i))). The element at the specified position, counting from 0. The argument should thus be a non-negative integer less than the size of the sequence. If the position is out of range, index fails with an error.
O(min(n,W)). Find the value at a key. Calls error when the element can not be found.
> fromList [(5,'a'), (3,'b')] ! 1 Error: element not in the map
> fromList [(5,'a'), (3,'b')] ! 5 == 'a'
Raise any value as an exception, provided it is in the Typeable class.
O(min(n,W)). 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'
Show more results