New arithmetic functions programmed in MINERVA are used exactly ...
Move to
Next Prev
Up Top
See also
HelloWorld
Use Parameters
Directives
Debugger
Arithmetic
Constraints
File From Server
AppletLoadsFile
GetURL
Client-Server with Sockets
Date
ExecProcess
ExecProcess_2
GUI
GuiEvents
Gui Image
Interactive
JavaToMinerva_1
JavaToMinerva_2
JavaToMinerva_3
JavaToMinerva_4
JavaToMinerva_5
JavaToMinerva_6
Java Applet Uses Minerva
JavaArrays
MinervaToJava
MinervaToJavaScript
MinervaToJava_1
MinervaToJava_2
MinervaToJava_3
MinervaToJava_4
Reflection
Servlet
JDBC
Internationalization
StartupArchive
IF Computer > MINERVA > Example Programs > MINERVA Features > Arithmetic

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

?-

read on...
MINERVA
ifcomputer logo
f
Expert Services on the Web
Language
English
Japanese
Server
USA
Japan
Site Access
Local Index
Local Contents
Site Contents
Site Index
Printer Friendly
For imode
For PDA
Search
document: http://www.ifcomputer.co.jp/MINERVA/ExamplePrograms/MinervaFeatures/Arithmetic/home_en.html
published 2008/5/12 update 2002/3/20 (c) 1996-2006 IF Computer Japan
IF Computer 5-28-2 Sendagi, Bunkyo-ku Tel +81-3-5814-3352 info@ifcomputer.com
Customer Support Tokyo 113-0022 Japan   http://www.ifcomputer.com
scroll to top managed with ubiCMS