A collection of common non-deterministic and/or combinatorial operations. Many operations are intended to operate on sets. The representation of these sets is not hidden; rather sets are represented as lists. Ideally these lists contains no duplicate elements and the order of their elements cannot be observed. In practice, these conditions are not enforced.
Author: Sergio Antoy (with extensions by Michael Hanus)
Version: January 2019
permute
:: [a] -> [a]
Compute any permutation of a list. |
subset
:: [a] -> [a]
Compute any sublist of a list. |
allSubsets
:: Ord a => [a] -> [[a]]
Compute all the sublists of a list. |
splitSet
:: [a] -> ([a],[a])
Split a list into any two sublists. |
sizedSubset
:: Int -> [a] -> [a]
Compute any sublist of fixed length of a list. |
partition
:: [a] -> [[a]]
Compute any partition of a list. |
Compute any permutation of a list.
|
Compute any sublist of a list. The sublist contains some of the elements of the list in the same order.
|
Compute all the sublists of a list.
|
Split a list into any two sublists.
|
Compute any sublist of fixed length of a list.
Similar to
|
Compute any partition of a list. The output is a list of non-empty lists such that their concatenation is a permutation of the input list. No guarantee is made on the order of the arguments in the output.
|