protocol

# varlistp

> List of variables protocol.

author:
  `Paulo Moura`
version:
  `1.1`
date:
  `2016/10/6`

compilation flags:
  `static`

(no dependencies on other entities)

## Public interface

### append/3

> Appends two lists.

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

### delete/3

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

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

### empty/1

> True if the argument is an empty list.

compilation flags:
  `static`
template:
  `empty(List)`
mode – number of proofs:
  `empty(@list) – zero_or_one`

### flatten/2

> Flattens a list of lists into a list.

compilation flags:
  `static`
template:
  `flatten(List,Flatted)`
mode – number of proofs:
  `flatten(@list,-list) – one`

### last/2

> List last element (if it exists).

compilation flags:
  `static`
template:
  `last(List,Last)`
mode – number of proofs:
  `last(@list,@var) – zero_or_one`

### length/2

> List length.

compilation flags:
  `static`
template:
  `length(List,Length)`
mode – number of proofs:
  `length(@list,?integer) – zero_or_one`

### memberchk/2

> Checks if a variable is a member of a list.

compilation flags:
  `static`
template:
  `memberchk(Element,List)`
mode – number of proofs:
  `memberchk(@var,@list) – zero_or_one`

### nextto/3

> X and Y are consecutive elements in List.

compilation flags:
  `static`
template:
  `nextto(X,Y,List)`
mode – number of proofs:
  `nextto(@var,@var,?list) – zero_or_more`

### nth0/3

> Nth element of a list (counting from zero).

compilation flags:
  `static`
template:
  `nth0(Nth,List,Element)`
mode – number of proofs:
  `nth0(?integer,+list,@var) – zero_or_more`

### nth0/4

> Nth element of a list (counting from zero).

compilation flags:
  `static`
template:
  `nth0(Nth,List,Element,Residue)`
mode – number of proofs:
  `nth0(?integer,+list,@var,?list) – zero_or_more`

### nth1/3

> Nth element of a list (counting from one).

compilation flags:
  `static`
template:
  `nth1(Nth,List,Element)`
mode – number of proofs:
  `nth1(?integer,+list,@var) – zero_or_more`

### nth1/4

> Nth element of a list (counting from zero).

compilation flags:
  `static`
template:
  `nth1(Nth,List,Element,Residue)`
mode – number of proofs:
  `nth1(?integer,+list,@var,?list) – zero_or_more`

### permutation/2

> The two lists are a permutation of the same list.

compilation flags:
  `static`
template:
  `permutation(List,Permutation)`
mode – number of proofs:
  `permutation(@list,@list) – zero_or_one`

### prefix/2

> Prefix is a prefix of List.

compilation flags:
  `static`
template:
  `prefix(Prefix,List)`
mode – number of proofs:
  `prefix(?list,@list) – zero_or_more`

### reverse/2

> Reverses a list.

compilation flags:
  `static`
template:
  `reverse(List,Reversed)`
mode – number of proofs:
  `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 flags:
  `static`
template:
  `same_length(List1,List2)`
mode – number of proofs:
  `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 flags:
  `static`
template:
  `select(Element,List,Remaining)`
mode – number of proofs:
  `select(@var,?list,?list) – zero_or_more`

### sublist/2

> The first list is a sublist of the second.

compilation flags:
  `static`
template:
  `sublist(Sublist,List)`
mode – number of proofs:
  `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 flags:
  `static`
template:
  `subtract(List,Elements,Remaining)`
mode – number of proofs:
  `subtract(@list,@list,-list) – one`

### suffix/2

> Suffix is a suffix of List.

compilation flags:
  `static`
template:
  `suffix(Suffix,List)`
mode – number of proofs:
  `suffix(?list,@list) – zero_or_more`

### valid/1

> Term is a valid list of variables.

compilation flags:
  `static`
template:
  `valid(Term)`
mode – number of proofs:
  `valid(@nonvar) – zero_or_one`

### check/1

> Checks if a term is a valid list of variables. Throws an exception if the term is not valid.

compilation flags:
  `static`
template:
  `check(Term)`
mode – number of proofs:
  `check(@nonvar) – one`

## Protected interface

(none)

## Private predicates

(none)

## Operators

### (none)

## Remarks

### (none)

## See also

- listp
- numberlistp