This module provides persistent lists. Prolog Lists are written
as [x_{1},..,x_{n}] and are internally constructed
by the pairing constructor [h|t] and the empty constructor []. The
length of such a list is n and the i-th element is x_{i}.
Most predicates are implemented such that they leave as few as
possible choice points.

?- last([1,2,3], X).

X = 3

?- last([1,2,3], X, Y).

X = 3,

Y = [1,2]

The predicates append/3, reverse/2, member/2, select/3, last/2
and last/3 work directly with lists. The predicates length/2,
nth0/3, nth0/4, nth1/3 and nth1/4 take also a length respective
index into account. The predicates maplist/n and foldl/n have a
closure argument to apply a predicate repeatedly to a number of
arguments.

The following list predicates are provided:

**append(L1, L2, L3):**- The predicate succeeds whenever L3 unifies with the concatenation of L1 and L2.
**reverse(L1, L2):**- The predicate succeeds whenever L2 unifies with the reverse of L1. The current implementation does not terminate on redo for an input L2 and an output L1.
**member(E, L):**- The predicate succeeds for every member E of the list L.
**select(E, L, R):**- The predicate succeeds for every member E of the L with remainder list R.
**last(L, E):**- The predicate succeeds with E being the last element of the list L.
**last(L, E, R):**- The predicate succeeds with E being the last element of the
list L and R being the remainder of the list.

**length(L, N):**- The predicate succeeds with N being the length of the list L.
**nth0(I, L, E):**- The predicate succeeds with E being the (I+1)-th element of the list L.
**nth0(I, L, E, R):**- The predicate succeeds with E being the (I+1)-th element of the list L and R being the remainder of the list.
**nth1(I, L, E):**- The predicate succeeds with E being the I-th element of the list L.
**nth1(I, L, E, R):**- The predicate succeeds with E being the I-th element of the
list L and R being the remainder of the list.

**maplist(C, L**_{1}, ..., L_{n}):- The predicate succeeds in applying the closure C to the
elements of L
_{1}, ..., L_{n}. The predicate is currently defined for 1 ≤ n ≤ 4. **foldl(C, L**_{1}**, ..., L**_{n}**, I, O):**- The predicate succeeds in applying the closure C to the
elements of L
_{1}, ..., L_{n}and accumulating the result among I and O. The predicate is currently defined for 1 ≤ n ≤ 4. -