protocol
listp
List protocol.
staticPublic predicates
append/2
Appends all lists in a list of lists.
staticappend(Lists,Concatenation)append(+list(list),?list) - zero_or_oneappend/3
Appends two lists.
staticappend(List1,List2,List)append(?list,?list,?list) - zero_or_moredelete/3
Deletes from a list all occurrences of an element returning the list of remaining elements. Uses ==/2 for element comparison.
staticdelete(List,Element,Remaining)delete(@list,@term,?list) - onedelete_matches/3
Deletes all matching elements from a list, returning the list of remaining elements. Uses =/2 for element comparison.
staticdelete_matches(List,Element,Remaining)delete_matches(@list,@term,?list) - oneempty/1
True if the argument is an empty list.
staticempty(List)empty(@list) - zero_or_oneflatten/2
Flattens a list of lists into a list.
staticflatten(List,Flatted)flatten(+list,-list) - onehamming_distance/3
Calculates the Hamming distance between two lists (using equality to compare list elements). Fails if the two lists are not of the same length.
statichamming_distance(List1,List2,Distance)hamming_distance(+list,+list,-integer) - zero_or_onekeysort/2
Sorts a list of key-value pairs in ascending order.
statickeysort(List,Sorted)keysort(+list(pair),-list(pair)) - onelast/2
List last element (if it exists).
staticlast(List,Last)last(?list,?term) - zero_or_morelength/2
List length.
staticlength(List,Length)length(?list,?integer) - zero_or_moremax/2
Determines the list maximum value using standard order. Fails if the list is empty.
staticmax(List,Maximum)max(+list,-term) - zero_or_onemember/2
Element is a list member.
staticmember(Element,List)member(?term,?list) - zero_or_morememberchk/2
Checks if a term is a member of a list.
staticmemberchk(Element,List)memberchk(?term,?list) - zero_or_onemin/2
Determines the minimum value in a list using standard order. Fails if the list is empty.
staticmin(List,Minimum)min(+list,-term) - zero_or_onemsort/2
Sorts a list in ascending order (duplicated elements are not removed).
staticmsort(List,Sorted)msort(+list,-list) - onemsort/3
Sorts a list using a user-specified comparison predicate modeled on the standard compare/3 predicate (duplicated elements are not removed).
staticmsort(Closure,List,Sorted)msort(3,*,*)msort(+callable,+list,-list) - onenextto/3
X and Y are consecutive elements in List.
staticnextto(X,Y,List)nextto(?term,?term,?list) - zero_or_morenth0/3
Nth element of a list (counting from zero).
staticnth0(Nth,List,Element)nth0(?integer,?list,?term) - zero_or_morenth0/4
Nth element of a list (counting from zero). Can be used to either select the nth element of List or to insert an element before the nth element in Rest.
staticnth0(Nth,List,Element,Rest)nth0(?integer,?list,?term,?list) - zero_or_morenth1/3
Nth element of a list (counting from one).
staticnth1(Nth,List,Element)nth1(?integer,?list,?term) - zero_or_morenth1/4
Nth element of a list (counting from one). Can be used to either select the nth element of List or to insert an element before the nth element in Rest.
staticnth1(Nth,List,Element,Rest)nth1(?integer,?list,?term,?list) - zero_or_morepartition/5
Partitions a list in lists with values less, equal, and greater than a given value (using standard order).
staticpartition(List,Value,Less,Equal,Greater)partition(+list,+number,-list,-list,-list) - onepermutation/2
The two lists are a permutation of the same list.
staticpermutation(List,Permutation)permutation(?list,?list) - zero_or_moreprefix/2
Prefix is a prefix of List.
staticprefix(Prefix,List)prefix(?list,+list) - zero_or_moreprefix/3
Prefix is a prefix of length Length of List.
staticprefix(Prefix,Length,List)prefix(?list,+integer,+list) - zero_or_oneprefix(?list,-integer,+list) - zero_or_moreproper_prefix/2
Prefix is a proper prefix of List.
staticproper_prefix(Prefix,List)proper_prefix(?list,+list) - zero_or_moreproper_prefix/3
Prefix is a proper prefix of length Length of List.
staticproper_prefix(Prefix,Length,List)proper_prefix(?list,+integer,+list) - zero_or_oneproper_prefix(?list,-integer,+list) - zero_or_moreremove_duplicates/2
Removes duplicated list elements using equality (==/2) for comparison and keeping the left-most element when repeated.
staticremove_duplicates(List,Set)remove_duplicates(+list,-list) - onereverse/2
Reverses a list.
staticreverse(List,Reversed)reverse(+list,?list) - zero_or_onereverse(?list,+list) - zero_or_onereverse(-list,-list) - one_or_moresame_length/2
The two lists have the same length.
staticsame_length(List1,List2)same_length(+list,?list) - zero_or_onesame_length(?list,+list) - zero_or_onesame_length(-list,-list) - one_or_moresame_length/3
The two lists have the same length.
staticsame_length(List1,List2,Length)same_length(+list,?list,?integer) - zero_or_onesame_length(?list,+list,?integer) - zero_or_onesame_length(-list,-list,-integer) - one_or_moreselect/3
Selects an element from a list, returning the list of remaining elements.
staticselect(Element,List,Remaining)select(?term,?list,?list) - zero_or_moreselectchk/3
Checks that an element can be selected from a list, returning the list of remaining elements.
staticselectchk(Element,List,Remaining)selectchk(?term,?list,?list) - zero_or_oneselect/4
Selects an element from a list, replacing it by a new element and returning the resulting list.
staticselect(Old,OldList,New,NewList)select(?term,?list,?term,?list) - zero_or_moreselectchk/4
Checks that an element from a list can be replaced by a new element, returning the resulting list.
staticselectchk(Old,OldList,New,NewList)selectchk(?term,?list,?term,?list) - zero_or_onesort/2
Sorts a list in ascending order (duplicated elements are removed).
staticsort(List,Sorted)sort(+list,-list) - onesort/3
Sorts a list using a user-specified comparison predicate modeled on the standard compare/3 predicate (duplicated elements are removed).
staticsort(Closure,List,Sorted)sort(3,*,*)sort(+callable,+list,-list) - onesort/4
Sorts a list using the given key and order. Uses the standard term comparison operators for the order. The key selects the argument in each element in the list to use for comparisons. A key value of zero uses the whole element for comparisons.
staticsort(Key,Order,List,Sorted)sort(+non_negative_integer,+atom,+list,-list) - one
Removing duplicates: Use one of the
@<or@>orders.Keeping duplicates: Use one of the
@=<or@>=orders.Sorting in ascending order: Use one of the
@<or@=<orders.Sorting in descending order: Use one of the
@>or@>=orders.
split/4
Splits a list into sublists of a given length. Also returns a list with the remaining elements. Fails if the length is zero or negative.
staticsplit(List,Length,Sublists,Remaining)split(+list,+integer,-list(list),-list) - zero_or_onesublist/2
The first list is a sublist of the second.
staticsublist(Sublist,List)sublist(?list,+list) - zero_or_moresubsequence/3
List is an interleaving of Subsequence and Remaining. Element order is preserved.
staticsubsequence(List,Subsequence,Remaining)subsequence(?list,?list,?list) - zero_or_moresubsequence/4
Generates subsequences of a given length from a list. Also returns the remaining elements. Element order is preserved.
staticsubsequence(List,Length,Subsequence,Remaining)subsequence(+list,+integer,?list,?list) - zero_or_moresubstitute/4
Substitutes all occurrences of Old in List by New, returning NewList. Uses term equality for element comparison.
staticsubstitute(Old,List,New,NewList)substitute(@term,@list,@term,-list) - onesubtract/3
Removes all elements in the second list from the first list, returning the list of remaining elements.
staticsubtract(List,Elements,Remaining)subtract(+list,+list,-list) - onesuffix/2
Suffix is a suffix of List.
staticsuffix(Suffix,List)suffix(?list,+list) - zero_or_moresuffix/3
Suffix is a suffix of length Length of List.
staticsuffix(Suffix,Length,List)suffix(?list,+integer,+list) - zero_or_onesuffix(?list,-integer,+list) - zero_or_moreproper_suffix/2
Suffix is a proper suffix of List.
staticproper_suffix(Suffix,List)proper_suffix(?list,+list) - zero_or_moreproper_suffix/3
Suffix is a proper suffix of length Length of List.
staticproper_suffix(Suffix,Length,List)proper_suffix(?list,+integer,+list) - zero_or_oneproper_suffix(?list,-integer,+list) - zero_or_moretake/3
Takes the first N elements of a list. Fails if the list have fewer than N elements.
statictake(N,List,Elements)take(+integer,+list,-list) - zero_or_onedrop/3
Drops the first N elements of a list. Fails if the list have fewer than N elements.
staticdrop(N,List,Remaining)drop(+integer,+list,-list) - zero_or_oneProtected predicates
(none)
Private predicates
(none)
Operators
(none)
See also