How to have a fact have multiple values in prolog?

Viewed 50

I am wondering how I can make a fact have multiple values for example:

answer(1-100, 'yes').
answer(100-700, 'no).

For 1-100 it would be yes and 100-700 it would be no. Writing thousands of facts would be too time consuming.

1 Answers

See the documentation for between/3:

answer( N , yes ) :- between(   1 , 100 < N ).
answer( N , no  ) :- between( 101 , 700 , N ).

Because life is too short to repeat the same thing over and over and over.

Related