protocol

listp

List protocol.

author:
Paulo Moura
version:
1.2
date:
2004/5/9
compilation:
static

(no dependencies on other files)

Public interface

append/3

Appends two lists.

compilation:
static
template:
append(List1, List2, List)
mode – number of solutions:
append(?list, ?list, ?list) – zero_or_more

delete/3

Deletes from a list all ocurrences of an element returning the list of remaining elements.

compilation:
static
template:
delete(List, Element, Remaining)
mode – number of solutions:
delete(@list, @term, ?list) – one

delete_matches/3

Deletes all matching elements from a list, returning the list of remaining elements.

compilation:
static
template:
delete_matches(List, Element, Remaining)
mode – number of solutions:
delete_matches(@list, @term, ?list) – one

empty/1

True if the argument is an empty list.

compilation:
static
template:
empty(List)
mode – number of solutions:
empty(@list) – zero_or_one

flatten/2

Flattens a list of lists into a list.

compilation:
static
template:
flatten(List, Flatted)
mode – number of solutions:
flatten(+list, -list) – one

keysort/2

Sorts a list of key-value pairs in ascending order.

compilation:
static
template:
keysort(List, Sorted)
mode – number of solutions:
keysort(+list, -list) – one

last/2

List last element (if it exists).

compilation:
static
template:
last(List, Last)
mode – number of solutions:
last(?list, ?term) – zero_or_more

length/2

List length.

compilation:
static
template:
length(List, Length)
mode – number of solutions:
length(?list, ?integer) – zero_or_more

max/2

Determines the list maximum value using standard order. Fails if the list is empty.

compilation:
static
template:
max(List, Maximum)
mode – number of solutions:
max(+list, -term) – zero_or_one

member/2

Element is a list member.

compilation:
static
template:
member(Element, List)
mode – number of solutions:
member(?term, ?list) – zero_or_more

memberchk/2

Checks if a term is a member of a list.

compilation:
static
template:
memberchk(Element, List)
mode – number of solutions:
memberchk(?term, ?list) – zero_or_one

min/2

Determines the minimum value in a list using standard order. Fails if the list is empty.

compilation:
static
template:
min(List, Minimum)
mode – number of solutions:
min(+list, -term) – zero_or_one

nextto/3

X and Y are consecutive elements in List.

compilation:
static
template:
nextto(X, Y, List)
mode – number of solutions:
nextto(?term, ?term, ?list) – zero_or_more

nth0/3

Nth element of a list (counting from zero).

compilation:
static
template:
nth0(Nth, List, Element)
mode – number of solutions:
nth0(?integer, ?list, ?term) – zero_or_more

nth0/4

Nth element of a list (counting from zero).

compilation:
static
template:
nth0(Nth, List, Element, Residue)
mode – number of solutions:
nth0(?integer, ?list, ?term, ?list) – zero_or_more

nth1/3

Nth element of a list (counting from one).

compilation:
static
template:
nth1(Nth, List, Element)
mode – number of solutions:
nth1(?integer, ?list, ?term) – zero_or_more

nth1/4

Nth element of a list (counting from zero).

compilation:
static
template:
nth1(Nth, List, Element, Residue)
mode – number of solutions:
nth1(?integer, ?list, ?term, ?list) – zero_or_more

permutation/2

The two lists are a permutation of the same list.

compilation:
static
template:
permutation(List, Permutation)
mode – number of solutions:
permutation(?list, ?list) – zero_or_more

prefix/2

Prefix is a prefix of List.

compilation:
static
template:
prefix(Prefix, List)
mode – number of solutions:
prefix(?list, +list) – zero_or_more

reverse/2

Reverses a list.

compilation:
static
template:
reverse(List, Reversed)
mode – number of solutions:
reverse(+list, ?list) – zero_or_one
reverse(?list, +list) – zero_or_one
reverse(-list, -list) – one_or_more

same_length/2

The two lists have the same length.

compilation:
static
template:
same_length(List1, List2)
mode – number of solutions:
same_length(+list, ?list) – zero_or_one
same_length(?list, +list) – zero_or_one
same_length(-list, -list) – one_or_more

select/3

Selects an element from a list, returning the list of remaining elements.

compilation:
static
template:
select(Element, List, Remaining)
mode – number of solutions:
select(?term, +list, ?list) – zero_or_more
select(?term, ?list, +list) – zero_or_more

sort/2

Sorts a list in ascending order.

compilation:
static
template:
sort(List, Sorted)
mode – number of solutions:
sort(+list, -list) – one

sublist/2

The first list is a sublist of the second.

compilation:
static
template:
sublist(Sublist, List)
mode – number of solutions:
sublist(?list, +list) – zero_or_more

subtract/3

Removes all elements in the second list from the first list, returning the list of remaining elements.

compilation:
static
template:
subtract(List, Elements, Remaining)
mode – number of solutions:
subtract(+list, +list, -list) – one

suffix/2

Suffix is a suffix of List.

compilation:
static
template:
suffix(Suffix, List)
mode – number of solutions:
suffix(?list, +list) – zero_or_more

Protected interface

(none)

Private predicates

(none)

Remarks

(none)