Documentation
¶
Index ¶
- func ChooseSet[T any](start, stopInclusive int, ...) func(propcheck.SimpleRNG) ([]T, propcheck.SimpleRNG)
- func SetEquality[T any](aa []T, bb []T, equality func(l, r T) bool) bool
- func SetIntersection[T any](a []T, b []T, lt, eq func(l, r T) bool) []T
- func SetMinus[T any](a []T, b []T, equality func(l, r T) bool) []T
- func SetUnion[T any](a []T, b []T, lt, eq func(l, r T) bool) []T
- func ToSet[T any](a []T, lt, eq func(l, r T) bool) []T
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ChooseSet ¶
func ChooseSet[T any](start, stopInclusive int, kind func(pair propcheck.SimpleRNG) (T, propcheck.SimpleRNG), lt func(l, r T) bool, eq func(l, r T) bool) func(propcheck.SimpleRNG) ([]T, propcheck.SimpleRNG)
Generates a set with A size in the indicated range using the given Gen lt - a predicate function that returns true if l is lexically less than r eq - a predicate function that returns true if l is equal to r Note that the returned set may not meet the minimum size requirement after de-duplication. This is impossible to handle in any general way(i.e. the set of bools with cardinality == 3).
func SetEquality ¶ added in v0.1.16
The efficiency of this algorithm is O(N)
func SetIntersection ¶ added in v0.1.16
Returns the intersection of set 'a' and 'b' The efficiency of this algorithm is O(5 * N)
func SetMinus ¶ added in v0.1.16
Returns the set 'a' minus set 'b' The efficiency of this algorithm is O(N)
func ToSet ¶
Makes a "real" set from an array. A "real" set is an array without duplicates based upon the given equality predicate. Note the set operations in arrays package do not depend on the array being "real". Making a set is expensive because it requires sorting and de-duplication. lt - a predicate function that returns true if l is lexically less than r eq - a predicate function that returns true if l is equal to r NOTE -- this is not a pure function. It mutates the input array a.
Types ¶
This section is empty.