object

# `difflist`

Difference list predicates.

Availability:
`logtalk_load(types(loader))`
Author: Paulo Moura
Version: 2:1:0
Date: 2026-02-03
Compilation flags:
`static, context_switching_calls`
Implements:
`public` listp
Extends:
`public` compound
Uses:
list
Remarks:
(none)
Inherited public predicates:
(<)/2 (=:=)/2 (=<)/2 (=\=)/2 (>)/2 (>=)/2 append/2 append/3 check/1 delete/3 delete_matches/3 depth/2 drop/3 empty/1 flatten/2 ground/1 hamming_distance/3 keysort/2 last/2 length/2 max/2 member/2 memberchk/2 min/2 msort/2 msort/3 new/1 nextto/3 nth0/3 nth0/4 nth1/3 nth1/4 numbervars/1 numbervars/3 occurrences/2 occurrences/3 occurs/2 partition/5 permutation/2 prefix/2 prefix/3 proper_prefix/2 proper_prefix/3 proper_suffix/2 proper_suffix/3 remove_duplicates/2 reverse/2 same_length/2 same_length/3 select/3 select/4 selectchk/3 selectchk/4 sequential_occurrences/2 sequential_occurrences/3 singletons/2 sort/2 sort/3 sort/4 split/4 sublist/2 subsequence/3 subsequence/4 substitute/4 subsumes/2 subterm/2 subtract/3 suffix/2 suffix/3 take/3 take/4 valid/1 variables/2 variant/2 varnumbers/2 varnumbers/3

## Public predicates

### `add/3`

Adds a term to the end of a difference list.

Compilation flags:
`static`
Template:
`add(Term,DiffList,NewDiffList)`
Mode and number of proofs:
`add(@term,+difference_list,-difference_list)` - `one`

### `as_list/2`

Returns a list with the elements of the difference list.

Compilation flags:
`static`
Template:
`as_list(DiffList,List)`
Mode and number of proofs:
`as_list(@difference_list,-list)` - `one`

## Protected predicates

(no local declarations; see entity ancestors if any)

## Private predicates

(no local declarations; see entity ancestors if any)

## Operators

(none)

See also

list, list(Type), numberlist, varlist