Previous topic  Top  Next topic  Print this Topic
 

ObjectLogic Built-ins

 

The descriptions of all of the Built-ins include arity, signatures (which indicate the type of the arguments), bindings (where f means that the argument must be free and b that it must be bound), plain English description, and examples. The abbreviations for the various types mentioned in the signatures are as follows:

Comparisons
==

Arity: 2

Signatures: various datatypes possible
Bindings: bb, bf, fb, ff
Description:

True if argument 2 can be obtained from argument 1 by variable renaming.

Examples:

?X==?Y

=

Arity: 2

Signatures: various datatypes possible
Bindings: ff, fb, bf, bb
Description:

Argument 1 unifies with argument 2.

Examples:

?X=?Y
?X=5

!=

Arity: 2

Signatures: various datatypes possible
Bindings: ff, fb, bf, bb
Description:

Argument 1 does not unify with argument 2.

Examples:

?X!=?Y

Basic Mathematical Built-ins

_multiply

Arity: 3
Signatures: =>(_number,_number,_number)
The arguments can be any number of a supported numeric data type. Conversion rules apply.
Bindings: fbb, bfb, bbf,
 
Description:

Multiplies the numbers in arguments 1 and 3. Binds the result to argument 3.

Examples:

_multiply(2,3,?X)

_add

Arity: 3
Signatures: =>(_number,_number,_number)
The arguments can be any number of a supported numeric data type. Conversion rules apply.
Bindings: fbb, bfb, bbf, bbb
Description:

Adds the numbers in arguments 1 and 2. Binds argument 3 to the result.

Examples:

_add(1,?X,5)

_abs

Arity: 2
Signatures: =>(_number,_number,_number)
The arguments can be any number of a supported numeric data type. Conversion rules apply.
Bindings: bf, fb, bb
Description:

Binds argument 2 to the absolute value of argument 1.

Examples:

_abs(-1,?X)

Basic Mathematical Functions
These are basic mathematical functions are available in is-statements, e.g. ?X is (?Y+3/?Z+5)*sin(?Z) which means that the value of the expression on the right is assigned to variable ?X. Note that functions are not prefixed with an underscore '_'.

mod will just be available for long and int. sin, cos, tan, asin, acos, atan, exp, pow, log and sqrt will just be availabe for double.

+

Arity: 1
Signatures: _number
Bindings: b
Description:

Multiplies argument by +1 and returns the result.

Examples:

+2

-

Arity: 1
Signatures: _number
Bindings: b
Description:

Multiplies argument 1 by -1 and returns the result.

Examples:

-2

+

Arity: 2
Signatures: (_number,_number), (_string,string), (_dateTime,_duration,), ( _time,_duration,),  (_date,_duration).
Bindings: bb
Description:

Adds the two numbers, strings, or dates/times with duration, and returns the result.

Examples:

3+2

-

Arity: 2
Signatures: (_number,_number,), (_dateTime,_duration,),  (_time,_duration,), (_date,_duration).
Bindings: bb
Description:

Subtracts the two numbers or dates/times with duration, and returns the result.

Examples:

3-2

*

Arity: 2
Signatures: _number,_number
Bindings: bb
Description:

Multiplies the two numbers given in arguments 1 and 2 and returns the result.

Examples:

3*2

/

Arity: 2
Signatures: _number,_number
Bindings: bb
Description:

Divides the two numbers given in arguments 1 and 2 and returns the result.

Examples:

3.2 / 1.1

mod

Arity: 2
Signatures: _integer,_integer
Bindings: bb
Description:

Computes the remainder of the division of the two integers given in arguments 1 and 2 and returns the result.

Examples:

5 mod 2

abs

Arity: 1
Signatures: _number
Bindings: b
Description:

Returns the absolute value of the argument.

Examples:

abs(-1)

max

Arity: 2
Signatures: _number,_number
Bindings: bb
Description:

Returns the greater of the values of arguments 1 and 2.

Examples:

max(1,2)

min

Arity: 2
Signatures: _number,_number
Bindings: bb
Description:

Returns the smaller of the values of arguments 1 and 2.

Examples:

min(1,2)

round

Arity: 1
Signatures: _number
Bindings: b
Description:

Returns the closest integer to the value of argument 1.

Examples:

round(2.4)

ceil

Arity: 1
Signatures: _number
Bindings: b
Description:

Returns the smallest _long or _integer value that is not smaller than the value in argument 1. _integer is returned if the argument is _integer or _decimal. Otherwise, _long is returned.

Examples:

ceil(2.3)

floor

Arity: 1
Signatures: _number
Bindings: b
Description:

Returns the largest _long or _integer value that is not smaller than the value in argument 1. _integer is returned if the argument is _integer or _decimal. Otherwise, _long is returned.

Examples:

floor(2.3)

tan

Arity: 1
Signatures: _double
Bindings: b
Description:

Returns the tangent of the value in argument 1.

Examples:

tan(0.8)

atan

Arity: 1
Signatures: _double
Bindings: b
Description:

Returns the arctangent of the value in argument 1.

Examples:

atan(8)

sin

Arity: 1
Signatures: _double
Bindings: b
Description:

Returns the sine of the value in argument 1.

Examples:

sin(5)

asin

Arity: 1
Signatures: _double
Bindings: b
Description:

Returns the arcsine of the value in argument 1.

Examples:

asin(0.5)

cos

Arity: 1
Signatures: _double
Bindings: b
Description:

Returns the cosine value of the value in argument 1.

Examples:

cos(8)

acos

Arity: 1
Signatures: _double
Bindings: b
Description:

Returns the arccosine value of the value in argument 1.

Examples:

acos(0.8)

exp

Arity: 1
Signatures: _number
Bindings: b
Description:

Returns the Euler's number raised to the power of the value given in argument 1.

Examples:

exp(3)

sqrt

Arity: 1
Signatures: _number
Bindings: b
Description:

Returns the positive square root of a positive number.

Examples:

exp(3)

log

Arity: 1
Signatures: _number,_number
Bindings: b
Description:

Returns natural the logarithm of the value in argument 1.

Examples:

log(1)

pow

Arity: 3
Signatures: _number,_number
Bindings: bb
Description:

Raises argument 1 to the power given in argument 2.

Examples:

pow(2,3)

 

from the copyright of the web page http://forum.projects.semwebcentral.org/forum-syntax.html