算術計算

MINERVAの新しい数式関数は、内蔵関数と全く同じように使用することが できます。

数式表現の関数表記と関係を示す表記の両方の表記が可能です。

MINERVAの数値を求める述語について、例えば、is/2を例に挙げて 考えます。 "Result = f(A,...,N)"のような関数は、 "f(A,...,N,Result)"の述語の探索として行なわれます。

これにより、MINERVAによる数式は、読みやすく、アグレッシブに 変数隠しを使用します。

% 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).

上のプログラムの結果は以下の通りです。

?- a(Price).

Price = 171.0

yes

?- b(Price).

Price = 171.0

yes

?-


戻る 続く..