# Module between

`:- use_module(library(between)).`

Predicates that generate integers

These predicates can be used to reason about integers in a reduced domain that follow some property. `library(clpz)`

provides another way of reasoning about integers that may also be interesting.

#### between(+Lower, +Upper, -X).

Given Lower and Upper are both integer numbers, true iff X is an integer so that *Lower =< X =< Upper*. Can be used both to check if X is between Lower and Upper or to generate an integer between Lower and Upper.

Examples:

```
?- between(10, 20, 15).
true.
?- between(10, 20, 25).
false.
?- between(3, 5, X).
X = 3
; X = 4
; X = 5.
```

#### gen_nat(?N)

True iff N is a natural number.

#### gen_int(?N)

True iff N is an integer.

#### repeat(+N)

Succeeds N times. This predicate is only included for compatibility and **should not be used** because it lacks a declarative interpretation.

#### numlist(?Upper, ?List)

True iff List is the list of integers *[1, ..., Upper]*. Example:

```
?- numlist(X, Y).
X = 1, Y = [1],
; X = 2, Y = [1,2]
; X = 3, Y = [1,2,3]
; ... .
```

#### numlist(?Lower, ?Upper, ?List).

True iff List is a list of the form *[Lower, ..., Upper]*. Example:

```
?- numlist(5, 10, X).
X = [5,6,7,8,9,10].
```