Did you know ... | Search Documentation: |
Pack purity -- docs/api_lists.md |
Up: Purity
plength(List, Length).
Length is the number of elements in List using the punary domain.
pnth0(Nth, Val, List).
Val is the Nth element in List starting at zero.
Nth is a punary number.
pnth1(Nth, Val, List).
Val is the Nth element in List starting at c(zero)
.
Nth is a punary number.
pmemberchk(Element, List, Truth).
check if Element exists in List once only.
Truth is true if the element exits. Truth is false if the element is not in the list.
pmemberchk(Element, List).
Equivilent of pmemberchk(Element, List, true)
.
psublist(List, Before, Length, After, SubList).
SubList is contained within List in the same sequence.
Before is the number of elements before SubList
Length is the number of elements in SubList
After is the number of elements after SubList
ppartition(Goal, List, Included, Excluded).
Using Goal as the decider, the elements of list are either in Included or Excluded.
Included and Excluded are also lists.
Goal is a predicate that has a pbool
as the last argument.
pinclude(Goal, List, Included).
Included is the List with the elements that are true for Goal.
Goal is a predicate that has a pbool
as the last argument.
pexclude(Goal, List, Excluded).
Excluded is the List without the elements that are true for Goal.
Goal is a predicate that has a pbool
as the last argument.
list_in-domain(Domain, List).
Holds if all elements of List are in Domain.
non_member(Domain, Element, List).
Holds if Element is not an element in List.
the Element and List must be a member of Domain.
remove_dups(List, NoDups).
NoDups is List without any repeating items.
list_join(ListOfLists, DelimList, ResultList).
ResultList is the ListOfLists flattened with DelimList separating each list
eg: ListOfLists = [[a],[b],[c]], DelimList = [','], ResultList = [a,',',b,',',c]
psort(Domain, List, Sordered)
Sorted is an ordered version of List.
all elements in List and Sorted must be in Domain.