Daml module
DA.List.BuiltinOrder
Note: This is only supported in Daml-LF 1.11 or later.
DamlAdded 3.4.9
Functions
dedup
dedup : Ord a => [a] -> [a]
dedup l removes duplicate elements from a list. In particular,
it keeps only the first occurrence of each element.
dedup is stable so the elements in the output are ordered
by their first occurrence in the input. If you do not need
stability, consider using dedupSort which is more efficient.
dedupOn
dedupOn : Ord k => (v -> k) -> [v] -> [v]
A version of dedup where deduplication is done
after applying the given function. Example use: dedupOn (.employeeNo) employees.
dedupOn is stable so the elements in the output are ordered
by their first occurrence in the input. If you do not need
stability, consider using dedupOnSort which is more efficient.
dedupSort
dedupSort : Ord a => [a] -> [a]
dedupSort is a more efficient variant of dedup
that does not preserve the order of the input elements.
Instead the output will be sorted acoording to the builtin Daml-LF
ordering.
dedupOnSort
dedupOnSort : Ord k => (v -> k) -> [v] -> [v]
dedupOnSort is a more efficient variant of dedupOn
that does not preserve the order of the input elements.
Instead the output will be sorted on the values returned by the function.
For duplicates, the first element in the list will be included in the output.
sort
sort : Ord a => [a] -> [a]
Sort the list according to the Daml-LF ordering.
Values that are identical according to the builtin Daml-LF ordering
are indistinguishable so stability is not relevant here.
sortOn
sortOn : Ord b => (a -> b) -> [a] -> [a]
sortOn f is a version of sort that allows sorting
on the result of the given function.
sortOn is stable so elements that map to the same sort key
will be ordered by their position in the input.
unique
unique : Ord a => [a] -> Bool
Returns True if and only if there are no duplicate elements in the given list.
uniqueOn
uniqueOn : Ord k => (a -> k) -> [a] -> Bool
Returns True if and only if there are no duplicate elements in the given list
after applyng function.
History
Added
3.4.9