This module provides a set of predicates for list processing.
Usage:nonsingle(X)
X is not a singleton.
Usage:append(Xs,Ys,Zs)
Zs is Ys appended to Xs.
Usage:reverse(Xs,Ys)
Reverses the order of elements in Xs.
Usage:reverse(A,B,C)
Reverse the order of elements in A, and append it with B.
Usage:delete(L1,E,L2)
L2 is L1 without the occurrences of E.
Usage:delete_non_ground(L1,E,L2)
L2 is L1 without the occurrences of E. E can be a nonground term so that all the elements in L1 it unifies with will be deleted
Usage:select(X,Xs,Ys)
Xs and Ys have the same elements except for one occurrence of X.
Usage 1:length(L,N)
Computes the length of L.
Usage 2:length(L,N)
Outputs L of length N.
Usage 3:length(L,N)
Checks that L is of length N.
N is the position in List of Elem. N counts from one.
Usage 1:
Unifies Elem and the Nth element of List.
Usage 2:
Finds the positions where Elem is in List. Positions are found in ascending order.
Usage:add_after(L0,E0,E,L)
Adds element E after element E0 (or at end) to list L0 returning in L the new list (uses term comparison).
Usage:add_before(L0,E0,E,L)
Adds element E before element E0 (or at start) to list L0 returning in L the new list (uses term comparison).
Usage:list1(T,X)
X is a list of Ys of at least one element.
Usage:dlist(List,DList,Tail)
List is the result of removing Tail from the end of DList (makes a difference list from a list).
Usage:list_concat(LL,L)
L is the concatenation of all the lists in LL.
Usage:list_insert(List,Term)
Adds Term to the end of List if there is no element in List identical to Term.
Usage:insert_last(L0,E,L)
Adds element E at end of list L0 returning L.
Usage:
Impure membership (does not instantiate a variable in its first argument.
Usage:
First membership.
Usage:nocontainsx(L,X)
X is not identical to any element of L.
Usage:last(L,X)
X is the last element of list L.
Usage:list_lookup(List,Functor,Key,Value)
Look up Functor(Key,Value) pair in variable ended key-value pair list L or else add it at the end.
Usage:intset_insert(A,B,Set)
Insert the element B in the ordered set of numbers A.
Usage:intset_delete(A,B,Set)
Delete from the ordered set A the element B.
Usage:intset_in(E,Set)
Succeds iff E is element of Set
Usage:intset_sequence(N,L1,L2)
Generates an ordered set of numbers from 0 to N-1, and append it to L1.
Usage:intersection(List1,List2,List)
List has the elements which are both in List1 and List2.
Usage:union(List1,List2,List)
List has the elements which are in List1 followed by the elements which are in List2 but not in List1.
Usage:difference(List1,List2,List)
List has the elements which are in List1 but not in List2.
Usage:sublist(List1,List2)
List2 contains all the elements of List1.
Usage:subordlist(List1,List2)
List2 contains all the elements of List1 in the same order.
Usage:equal_lists(List1,List2)
List1 has all the elements of List2, and vice versa.
Usage 1:list_to_list_of_lists(List,LList)
Usage 2:list_to_list_of_lists(List,LList)
LList is the list of one element lists with elements of List.
Usage:powerset(List,LList)
LList is the powerset of List, i.e., the list of all lists which have elements of List. If List is ordered, LList and all its elements are ordered.
Usage:cross_product(LList,List)
List is the cartesian product of the lists in LList, that is, the list of lists formed with one element of each list in LList, in the same order.
Usage:sequence_to_list(Sequence,List)
List is the list of all elements in the (comma-separated) sequence Sequence. The use of this predicate is reversible.
list_of_lists([]). list_of_lists([L|Xs]) :- list(L), list_of_lists(Xs).