List +Data -package
Operations on lists.
Constructs an immutable array from a list of initial elements. The list gives the elements of the array in ascending order beginning with the lowest index.
Construct an array from a pair of bounds and a list of values in index order.
Get a list of all entities that meet a predicate
Convert a list of key/value pairs into a hash table. Equality on keys is taken from the Eq instance for the key type.
Converts a hash table to a list of key/value pairs.
List of elements of a structure.
O(n). Build a map from a list of key/value pairs are in ascending order.
> fromAscList [(3,"b"), (5,"a")] == fromList [(3, "b"), (5, "a")]
> fromAscList [(3,"b"), (5,"a"), (5,"b")] == fromList [(3, "b"), (5, "b")]
O(n). Build a set from an ascending list of elements. The precondition (input list is ascending) is not checked.
O(n). Build a set from an ascending list in linear time. The precondition (input list is ascending) is not checked.
O(n). Build a map from an ascending list in linear time. The precondition (input list is ascending) is not checked.
> fromAscList [(3,"b"), (5,"a")] == fromList [(3, "b"), (5, "a")]
> fromAscList [(3,"b"), (5,"a"), (5,"b")] == fromList [(3, "b"), (5, "b")]
> valid (fromAscList [(3,"b"), (5,"a"), (5,"b")]) == True
> valid (fromAscList [(5,"a"), (3,"b"), (5,"b")]) == False
O(n). Build a map from a list of key/value pairs are in ascending order, with a combining function on equal keys. The precondition (input list is ascending) is not checked.
> fromAscListWith (++) [(3,"b"), (5,"a"), (5,"b")] == fromList [(3, "b"), (5, "ba")]
O(n). Build a map from an ascending list in linear time with a combining function for equal keys. The precondition (input list is ascending) is not checked.
> fromAscListWith (++) [(3,"b"), (5,"a"), (5,"b")] == fromList [(3, "b"), (5, "ba")]
> valid (fromAscListWith (++) [(3,"b"), (5,"a"), (5,"b")]) == True
> valid (fromAscListWith (++) [(5,"a"), (3,"b"), (5,"b")]) == False
O(n). Build a map from a list of key/value pairs are in ascending order, with a combining function on equal keys. The precondition (input list is ascending) is not checked.
> fromAscListWith (++) [(3,"b"), (5,"a"), (5,"b")] == fromList [(3, "b"), (5, "ba")]
O(n). Build a map from a list of key/value pairs are in ascending order, with a combining function on equal keys. The precondition (input list is ascending) is not checked.
> let f key new_value old_value = (show key) ++ ":" ++ new_value ++ "|" ++ old_value
> fromAscListWithKey f [(3,"b"), (5,"a"), (5,"b")] == fromList [(3, "b"), (5, "5:b|a")]
O(n). Build a map from an ascending list in linear time with a combining function for equal keys. The precondition (input list is ascending) is not checked.
> let f k a1 a2 = (show k) ++ ":" ++ a1 ++ a2
> fromAscListWithKey f [(3,"b"), (5,"a"), (5,"b"), (5,"b")] == fromList [(3, "b"), (5, "5:b5:ba")]
> valid (fromAscListWithKey f [(3,"b"), (5,"a"), (5,"b"), (5,"b")]) == True
> valid (fromAscListWithKey f [(5,"a"), (3,"b"), (5,"b"), (5,"b")]) == False
Show more results