Arithmetic

New arithmetic functions programmed in MINERVA are used exactly as built in functions.

This allows both functional and relational notations for arithmetic expressions.

MINERVA predicates for arithmetic evaluation, e.g. is/2 used on a function like "Result = f(A,...,N)" will search for a predicate "f(A,...,N,Result)".

Thus arithmetic in MINERVA becomes easier to read and uses aggresive variable hiding.

% example: compute the cost for industrial urethane foam

% notation as relations a(Price) :- height(H), width(W), depth(D), unit_price_per_volume(U), Price is H * W * D * U.

% notation as functions

b(Price) :- Price is height * width * depth * unit_price_per_volume.

% uniform notation of functions resp. data base

height(6). depth(38). width(75). unit_price_per_volume(0.01).

Here is the result for the above program:

?- a(Price).

Price = 171.0

yes

?- b(Price).

Price = 171.0

yes

?-


Darueber read on...