[ Reference Manual | Alphabetic Index ]


Predicates for list manipulation   [more]


No description available
all_same_length(?, ?)
No description available
append(+ListOfLists, -LongList)
Concatenate a list of lists
append(?List1, ?List2, ?List3)
Succeeds if List3 is the result of appending List2 to List1.
checklist(+Pred, +List)
Succeeds if Pred(Elem) succeeds for every element of List.
collection_to_list(+Collection, -List)
Convert a "collection" into a list
delete(?Element, ?List1, ?List2)
Succeeds if List2 is List1 less an occurence of Element in List1.
flatten(+NestedList, ?FlatList)
Succeeds if FlatList is the list of all elements in NestedList, as found in a left-to-right, depth-first traversal of NestedList.
flatten(++MaxDepth, +NestedList, ?FlatList)
Depth-limited list flattening
halve(+List, ?Front, ?Back)
Split a list in the middle
intersection(+List1, +List2, ?Common)
Succeeds if Common unifies with the list which contains the common elements of List1 and List2.
length(?List, ?N)
Succeeds if the length of list List is N.
maplist(+Pred, +List)
Succeeds if Pred(Elem) succeeds for every element of List.
maplist(+Pred, ?OldList, ?NewList)
Succeeds if Pred(Old, New) succeeds for corresponding pairs of elements from OldList and NewList.
member(?Term, ?List)
Succeeds if Term unifies with a member of the list List.
memberchk(+Term, ?List)
Succeeds if Term is a member of the list List.
middle_out(+List, -Reordered)
Reorder a list such that the middle elements come first
nonmember(+Element, +List)
Succeeds if Element is not an element of the list List.
Print the elements of a list, one per line
reverse(+List, ?Reversed)
Succeeds if Reversed is the reversed list List.
select(?Element, ?List1, ?List2)
Succeeds if List2 is List1 less an occurence of Element in List1.
shuffle(+List, ?ShuffledList)
Shuffle a list, ie randomize the element order
splice(?Odds, ?Evens, ?List)
Merge two lists by interleaving the elements
subset(?SubList, +List)
Succeeds if List is the list which contains all elements from SubList in the same order as in SubList.
subtract(+List1, +List2, ?Remainder)
Succeeds if Remainder is the list which contains those elements of List1 which are not in List2.
union(+List1, +List2, ?Union)
Succeeds if Union is the list which contains the union of elements in List1 and those in List2.



Library containing various simple list manipulation predicates which require no special form of lists. For ordered lists see library(ordset). A number of basic list processing predicates (is_list/1, append/3, member/2, length/2 etc) are available by default and do not require this library to be loaded.

Note that in the predicate descriptions for this library, the '+' mode in the mode specification for list-valued arguments indicates that the list argument is required to be a proper list in the sense of is_list/1, i.e. all list tails must be recursively instantiated.


Generated from lists.eci on 2022-04-24 18:55