Minerva offers 2 built-in predicates for function style evaluation...
Move to
Next Prev
Up Top
See also
Invocation
Predicates
Directives
Arithmetic
Functions
Objects
Error Messages
File Names
main
Packages
Debugger
Internationalization
Gui Programming
MINERVA to Java Interface
Java to MINERVA Interface
Restrictions
IF Computer > MINERVA > Manual > Reference > Functions

Functions

Minerva offers 2 built-in predicates for function style evaluation of built-in and user defined predicates.

is/2 	arithmetic evaluation
<-/2	function evaluation

Programming with functions is sometimes easier to write and read than the equivalent predicate.

You can define an arithmetic function with a predicate that returns its value in the last argument

somearithmetic(Arg1,...,ArgN,Result)
and call it either in relational notation with
?- somearithmetic(Arg1,...,ArgN,Result)
or in functional notation with
?- Result is somearithmetic(Arg1,...,ArgN).

You can define a general function with a predicate that returns its value in the last argument

Predicate(Arg1,...,ArgN,Result)
and call it either in relational notation with
?- Predicate(Arg1,...,ArgN,Result)
or in functional notation with
?- Result <- Predicate(Arg1,...,ArgN).

<-/2 behaves as defined like

Res <- Goal :-
	Goal =.. [Name|Args],
	append(Args,[Res],XtArgs),
	XtGoal =.. [Name|XtArgs],
	call(XtGoal).

but is/2 and <-/2 are efficiently implemented builtin predicates of MINERVA.

Example with classic Prolog:

List <- append([a,b,c],[d,e,f])

Example with a MINERVA Object:

Counter <- create_counter(10),
Index <- Counter::next,
...

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/Manual/Reference/Functions/home_en.html
published 2008/7/21 update 2003/2/28 (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