-1

与えられたデータベースを取る、例えば

input(80).
input(30).
input(25).
input(90).

/1 入力のみを取得するように制限して、50 × 100 を超える入力の量を計算します。例えば

%compute(?integer).
compute(I).
I = 200 %seeing as input(80) and input(90) matches the condition of being above 50

計算機能を模倣するために次のプロローグ コードを試しましたが、失敗しました。

compute(I) :- input(G), G>50, I is I+100.

I+100 が意図したとおりに機能しません。

4

1 に答える 1