## Prolog exercise: Min and Max of a list

As a fun exercise I implemented a predicate to calculate the minimum and maximum element of a list.

```
min_and_max([A], A, A).
min_and_max([H|R], N, X):-
min_and_max(R, RN, RX),
N is min(H, RN),
X is max(H, RX).
```

Next I wrote a version with last-call optimization.

`min_and_max_2 …`