ordsets(3erl)
π ordsets π
okay so welcome to the ordsets(3erl) page β Erlang Module Definition, but make it make sense. No gatekeeping, just ordered-list set vibes. π¦
β¨ NAME β¨
ordsets β Functions for manipulating sets as ordered lists. π
πΈ DESCRIPTION πΈ
Okay so a set is a collection of elements with no duplicate elements β like a group chat where nobody can be added twice. An ordset is a representation of a set, where an ordered list is used to store the elements of the set. An ordered list is more efficient than an unordered list. Elements are ordered according to the Erlang term order. slay. β¨
This module provides the same interface as the sets(3erl) module but with a defined representation. One difference is that while sets considers two elements as different if they do not match (=:=), this module considers two elements as different if and only if they do not compare equal (==). That's the plot twist, bestie. π
π DATA TYPES π
ordset(T) = [T]
Types, bestie:
ordset(T) = [T]
As returned by new/0. π
π₯ EXPORTS π₯
add_element(Element, Ordset1) -> Ordset2
Types:
Element = E
Ordset1 = ordset(T)
Ordset2 = ordset(T | E)
Returns a new ordered set formed from Ordset1 with Element inserted. new set, who dis? π
del_element(Element, Ordset1) -> Ordset2
Types:
Element = term()
Ordset1 = Ordset2 = ordset(T)
Returns Ordset1, but with Element removed. bye bestie π
filter(Pred, Ordset1) -> Ordset2
Types:
Pred = fun((Element :: T) -> boolean())
Ordset1 = Ordset2 = ordset(T)
Filters elements in Ordset1 with boolean function Pred. only the ones that pass the vibe check survive β¨
fold(Function, Acc0, Ordset) -> Acc1
Types:
Function =
fun((Element :: T, AccIn :: term()) -> AccOut :: term())
Ordset = ordset(T)
Acc0 = Acc1 = term()
Folds Function over every element in Ordset and returns the final value of the accumulator. it's giving very main character energy π₯
from_list(List) -> Ordset
Types:
List = [T]
Ordset = ordset(T)
Returns an ordered set of the elements in List. turn that list into a set, periodt π
intersection(OrdsetList) -> Ordset
Types:
OrdsetList = [ordset(term()), ...]
Ordset = ordset(term())
Returns the intersection of the non-empty list of sets. common elements only, no cap π
intersection(Ordset1, Ordset2) -> Ordset3
Types:
Ordset1 = Ordset2 = Ordset3 = ordset(term())
Returns the intersection of Ordset1 and Ordset2. π
is_disjoint(Ordset1, Ordset2) -> boolean()
Types:
Ordset1 = Ordset2 = ordset(term())
Returns true if Ordset1 and Ordset2 are disjoint (have no elements in common), otherwise false. no overlap, no drama π¦
is_element(Element, Ordset) -> boolean()
Types:
Element = term()
Ordset = ordset(term())
Returns true if Element is an element of Ordset, otherwise false. are they in the set or not? icon behavior π
is_empty(Ordset) -> boolean()
Types:
Ordset = ordset(term())
Returns true if Ordset is an empty set, otherwise false. empty set rights πΈ
is_set(Ordset) -> boolean()
Types:
Ordset = term()
Returns true if Ordset is an ordered set of elements, otherwise false. This function will return true for any ordered list, even when not constructed by the functions in this module.
π¨ real talk:is_set(Ordset)will returntruefor any ordered list, even when not constructed by the functions in this module. So don't let that fool you, bestie. π
is_subset(Ordset1, Ordset2) -> boolean()
Types:
Ordset1 = Ordset2 = ordset(term())
Returns true when every element of Ordset1 is also a member of Ordset2, otherwise false. tiny set, big set, subset check β¨
new() -> []
Returns a new empty ordered set. fresh start, clean slate, [] energy π
size(Ordset) -> integer() >= 0
Types:
Ordset = ordset(term())
Returns the number of elements in Ordset. count them, bestie π’
subtract(Ordset1, Ordset2) -> Ordset3
Types:
Ordset1 = Ordset2 = Ordset3 = ordset(term())
Returns only the elements of Ordset1 that are not also elements of Ordset2. subtract the overlap, keep the rest π
to_list(Ordset) -> List
Types:
Ordset = ordset(T)
List = [T]
Returns the elements of Ordset as a list. set to list, slay the conversion π
union(OrdsetList) -> Ordset
Types:
OrdsetList = [ordset(T)]
Ordset = ordset(T)
Returns the merged (union) set of the list of sets. all the sets, merged together, no duplicates π
union(Ordset1, Ordset2) -> Ordset3
Types:
Ordset1 = ordset(T1)
Ordset2 = ordset(T2)
Ordset3 = ordset(T1 | T2)
Returns the merged (union) set of Ordset1 and Ordset2. bestie merge π₯
π SEE ALSO π
okay that's the whole ordsets(3erl) page β big hugs from the ordered-list set bestie zone. π«Ά Footer shoutout: Ericsson AB, stdlib 4.3.1.3, page ordsets(3erl) β no date line in this footer, just those source/version vibes. periodt π
β¨
π¦ where this page comes from
- ubuntu noble: erlang-manpages 1:25.3.2.8+dfsg-1ubuntu4 Β· Apache-2.0
- ubuntu noble: erlang-manpages 1:25.3.2.8+dfsg-1ubuntu4.8 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms