Sets
Type signatures are provisional and may contain errors.
Data jetted sets of nouns. Sets are represented as a law where the row has no duplicate elements and all elements are stored in ascending order, with the form:
(0 1 2 row)Set Functions
isSet
(isSet x)
> x : a
> BoolChecks if a value is a valid set.
isSet %[] == 1
isSet %[1 2 3] == 1
isSet (0 1 2 []) == 1
isSet (0 2 2 []) == 0 ; Invalid set representation
isSet [1 2 3] == 0 ; Not a set, just a rowemptySet
(emptySet)
> Set aReturns an empty set.
setIsEmpty
Checks if a set is empty.
setSing
Creates a singleton set containing one element.
setFromRow
Creates a set from a row, removing duplicates and sorting.
setFromRowAsc
Creates a set from a row that is already in ascending order with no duplicates.
setToRow
Converts a set to a row.
setLen
Returns the number of elements in a set.
setToList
Converts a set to a list.
setFoldl
Left-associative fold over a set.
setFoldr
Right-associative fold over a set.
setIns
Inserts an element into a set.
setDel
Removes an element from a set.
setHas
Checks if an element is in a set.
setWeld
Combines two sets.
setUnion
Alias for setWeld. Combines two sets.
setCatRow
Combines a row of sets into a single set.
setCatList
Combines a list of sets into a single set.
setCatRowAsc
Combines a row of sets that are already in ascending order.
setMin
Returns the minimum element in a set.
setMax
Returns the maximum element in a set.
setPop
Removes and returns the minimum element from a set.
setDrop
Removes the first n elements from a set.
setTake
Keeps the first n elements of a set.
setSplitAt
Splits a set at a given index.
setSplitLT
Splits a set into elements less than a given value and the rest.
setIntersect
Returns the intersection of two sets.
setSub
Subtracts one set from another.
setElem
Returns the nth element of a set.
setDifference
Alias for setSub.
setInsert
Alias for setIns.
setSubtract
Alias for setSub.
setIntersection
Alias for setIntersect.
Last updated