Documentation

## Examples

### Append

```append(c(1,c(2,c(3,n))),c(4,c(5,n)),result).
append(X,Y,Z), n(X)      :- Y=Z.
append(X,Y,Z), c(A,X1,X) :- c(A,Z1,Z), append(X1,Y,Z1).```

RESULT: result(c(1,c(2,c(3,c(4,c(5,n)))))) with the two rules above.

```result = append([1,2,3],[4,5]).
Z=append([],    Y) :- Z=Y.
Z=append([A|X1],Y) :- Z=[A|append(X1,Y)].```

RESULT: result=[1,2,3,4,5] with the two rules above.

### Self-Organizing Loops

```a(free,free),a(free,free),a(free,free),a(free,free),a(free,free),
a(free,free),a(free,free),a(free,free),a(free,free),a(free,free),
a(free,free),a(free,free),a(free,free),a(free,free),a(free,free),
a(free,free),a(free,free),a(free,free),a(free,free),a(free,free),
a(free,free),a(free,free),a(free,free),a(free,free).
a(X,free),a(free,Y) :- a(X,C),a(C,Y).```

RESULT: Many possible results.

### Vending Machine

```{customer,a,one,one,five,hunger,hunger}.
{customer,b,five,hunger}.
{vending,choco,choco,choco,one,one}.
{customer,\$c,hunger,five},  {vending,\$v,choco,one,one}
:- {customer,\$c,choco,one,one},{vending,\$v,five}.
{customer,\$c,hunger,one,one,one},{vending,\$v,choco}
:- {customer,\$c,choco},             {vending,\$v,one,one,one}.```

Two customers with different amounts of coins and hunger are buying some chocolates from a vending machine. Each chocolate costs three and only two kinds of coins are considered: one and five.

Run this program several times in shuffle mode (type shuffle) to observe its non-deterministic behavior.