varlistp — Logtalk APIs v3.47.0 documentation

protocol

# `varlistp`

List of variables protocol.

Author: Paulo Moura
Version: 1:2:0
Date: 2019-01-03
Compilation flags:
`static`
Dependencies:
(none)
Remarks:
(none)
Inherited public predicates:
(none)

- Public predicates

  - `append/3`

  - `delete/3`

  - `empty/1`

  - `flatten/2`

  - `last/2`

  - `length/2`

  - `memberchk/2`

  - `nextto/3`

  - `nth0/3`

  - `nth0/4`

  - `nth1/3`

  - `nth1/4`

  - `permutation/2`

  - `prefix/2`

  - `remove_duplicates/2`

  - `reverse/2`

  - `same_length/2`

  - `select/3`

  - `sublist/2`

  - `subtract/3`

  - `suffix/2`

  - `valid/1`

  - `check/1`

- Protected predicates

- Private predicates

- Operators

## Public predicates

### `append/3`

Appends two lists.

Compilation flags:
`static`
Template:
`append(List1,List2,List)`
Mode and 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 and 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 and 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 and number of proofs:
`flatten(@list,-list)` - `one`

### `last/2`

List last element (if it exists).

Compilation flags:
`static`
Template:
`last(List,Last)`
Mode and number of proofs:
`last(@list,@var)` - `zero_or_one`

### `length/2`

List length.

Compilation flags:
`static`
Template:
`length(List,Length)`
Mode and 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 and 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 and 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 and number of proofs:
`nth0(?integer,+list,@var)` - `zero_or_more`

### `nth0/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`.

Compilation flags:
`static`
Template:
`nth0(Nth,List,Element,Rest)`
Mode and 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 and number of proofs:
`nth1(?integer,+list,@var)` - `zero_or_more`

### `nth1/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`.

Compilation flags:
`static`
Template:
`nth1(Nth,List,Element,Rest)`
Mode and 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 and 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 and number of proofs:
`prefix(?list,@list)` - `zero_or_more`

### `remove_duplicates/2`

Removes duplicated variables and keeping the left-most variable when repeated.

Compilation flags:
`static`
Template:
`remove_duplicates(List,Set)`

### `reverse/2`

Reverses a list.

Compilation flags:
`static`
Template:
`reverse(List,Reversed)`
Mode and number of proofs:
`reverse(+list,-list)` - `one`
`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 and 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 and 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 and 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 and number of proofs:
`subtract(@list,@list,-list)` - `one`

### `suffix/2`

`Suffix` is a suffix of `List`.

Compilation flags:
`static`
Template:
`suffix(Suffix,List)`
Mode and 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 and 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 and number of proofs:
`check(@nonvar)` - `one`

## Protected predicates

(none)

## Private predicates

(none)

## Operators

(none)

See also

varlist, listp, numberlistp