Skip to content
Snippets Groups Projects
Commit d5815084 authored by Fredrik Hübinette (Hubbe)'s avatar Fredrik Hübinette (Hubbe)
Browse files

operator function documents added

Rev: doc/operators/and:1.1
Rev: doc/operators/complement:1.1
Rev: doc/operators/divide:1.1
Rev: doc/operators/is_equal:1.1
Rev: doc/operators/is_greater_or_equal:1.1
Rev: doc/operators/is_greater_than:1.1
Rev: doc/operators/is_lesser_or_equal:1.1
Rev: doc/operators/is_lesser_than:1.1
Rev: doc/operators/minus:1.1
Rev: doc/operators/modulo:1.1
Rev: doc/operators/mult:1.1
Rev: doc/operators/not:1.1
Rev: doc/operators/not_equal:1.1
Rev: doc/operators/or:1.1
Rev: doc/operators/plus:1.1
Rev: doc/operators/shift_left:1.1
Rev: doc/operators/shift_right:1.1
Rev: doc/operators/xor:1.1
parent 6ea8a451
Branches
Tags
No related merge requests found
Showing with 393 additions and 0 deletions
NAME
`& - intersection
SYNTAX
a & b
or
mixed `&(mixed ... args)
DESCRIPTION
This operator does logical intersections. For ints this means
bitwise and.
Arrays and lists are treated as sets, so intersecting two arrays
will result in an array with containing all values present in all
arguments.
For mappings, the intersection will be done on the indexes solely,
however, the values will be taken from the rightmost mapping.
KEYWORDS
operator
SEE ALSO
`|, `^
NAME
`~ - bitwise complement
SYNTAX
~ a
or
int `~(int a)
DESCRIPTION
This operator inverses all bits in an integer and returns the
new integer.
KEYWORDS
operator
SEE ALSO
`&, `|, `^
\ No newline at end of file
NAME
`/ - division
SYNTAX
a / b
or
int `/(int a, int b)
or
float `/(int|float a,int|float b)
or
string* `/(string a,string b)
DESCRIPTION
For ints and floats, this operator simply divide its arguments.
If the arguments are strings, the first string will be divided
at every occurance of the second string. The resulting pieces
are then returned in the form of an array.
EXAMPLES
2/2 returns 1
3/2 returns 1
2.0/2.0 returns 1.0
2.0/2 returns 1.0
"foo"/"o" returns ({"f","",""})
`/(2,2) returns 1
KEYWORDS
operator
SEE ALSO
`*, `%
NAME
`== - compare values
SYNTAX
a == b
or
int `==(mixed a, mixed b)
DESCRIPTION
This operator compares two values and returns 1 if they are the same,
0 otherwise. Note that pointer equivialenec is required for arrays,
objects, programs, mappings and lists. (Thus it is not enough that
two arrays LOOK alike, it must be the same array.)
KEYWORDS
operator
SEE ALSO
`!=, `<, `>, `<=, `>=, efuns/equal
NAME
`>= - is greater than or equal to?
SYNTAX
a >= b
or
int `>=(int|float|string a,int|float|string b)
DESCRIPTION
This operator compares two values and returns 1 if the first one
is greater than or equal to the second one.
KEYWORDS
operator
SEE ALSO
`!=, `==, `>, `<, `<=
NAME
`> - is lesser than?
SYNTAX
a > b
or
int `>(int|float|string a,int|float|string b)
DESCRIPTION
This operator compares two values and returns 1 if the first one
is greater than the second one.
KEYWORDS
operator
SEE ALSO
`!=, `==, `<, `<=, `>=
NAME
`<= - is lesser or equal than?
SYNTAX
a <= b
or
int `<=(int|float|string a,int|float|string b)
DESCRIPTION
This operator compares two values and returns 1 if the first one
is lesser than or equal to the second one.
KEYWORDS
operator
SEE ALSO
`!=, `==, `>, `<, `>=
NAME
`< - is lesser than?
SYNTAX
a < b
or
int `<(int|float|string a,int|float|string b)
DESCRIPTION
This operator compares two values and returns 1 if the first one
is lesser than the second one.
KEYWORDS
operator
SEE ALSO
`!=, `==, `>, `<=, `>=
NAME
`- - subtract/negate
SYNTAX
- a
or
`-(mixed a);
or
a - b
or
mixed `-(mixed a, mixed b)
DESCRIPTION
This is the negation and subtraction operator, for ints and floats
the operation should be obvious.
For arrays, an array containing all elements present in a and not in
b is returne. The order of the remaining values from a will be kept.
For lists, the same operation is done as for arrays, except order is
of course not considered.
For mappings, a mapping is returned with every key-index pair from
a whos index is not present as an index in b.
EXAMPLES
5-10 returns -5
10-2.0 returns 8.0
({1,2})-({2}) returns ({1})
([1:2,2:1])-([1:0]) returns ([2:1])
KEYWORDS
operator
SEE ALSO
`+
NAME
`% - modulo
SYNTAX
a % b
or
int `%(int a, int b)
or
float `%(int|float a,int|float b)
DESCRIPTION
This operator computes the rest of a division. For integers, this
is the same as same as computing a-(a/b)*a. For floats, modulo is
interpreted as a-floor(a/b)*a
EXAMPLES
9%3 returns 0
10%3 returns 1
2%0.3 returns 0.2
KEYWORDS
operator
SEE ALSO
`/, `*
NAME
`* - multiplication
SYNTAX
a * b
or
int `*(int ... args)
or
float `*(int|float ... args)
or
string `*(string *strings, string delimeter)
DESCRIPTION
For ints and floats, this operator simply multiplies its arguments.
If the first argument is an array, and the second a string, all
strings in the arrays will be concatenated, with the delimiter in
between each string and the result will be returned.
EXAMPLES
2*2 returns 4
2.0*2.0 returns 4.0
2.0*2 returns 4.0
({"f","",""})*"o") Returns "foo"
`*(2,2,2) returns 8
KEYWORDS
operator
SEE ALSO
`/
NAME
`! - is not true
SYNTAX
! a
or
int `!(mixed a)
DESCRIPTION
Returns 1 if a is zero, 0 otherwise.
KEYWORDS
operator
NAME
`!= - check if not equal
SYNTAX
a != b
or
int `!=(mixed a, mixed b)
DESCRIPTION
This operator compares two values and returns 0 if they are the same,
1 otherwise. Note that pointer equivialenec is required for arrays,
objects, programs, mappings and lists. (Thus it is not enough that
two arrays LOOK alike, it must be the same array.)
KEYWORDS
operator
SEE ALSO
`==, `<, `>, `<=, `>=, efuns/equal
NAME
`| - union
SYNTAX
a | b
or
mixed `|(mixed ... args)
DESCRIPTION
This operator does logical unions. For ints this means bitwise or.
Arrays and lists are treated as sets, so doing a union on two arrays
will result in an array with containing all values present in either
array. Although values present in both ararys will only be present
once in the result.
For mappings, the intersection will be done on the indexes solely,
however, the values will be taken from the rightmost mapping.
KEYWORDS
operator
SEE ALSO
`&, `^
NAME
`+ - add things together
SYNTAX
a + b
or
mixed `+(mixed ... args)
DESCRIPTION
For ints and floats this operator simply adds the two operators
together. For strings and arrays, concatenation is done. For lists
and mapping this creates a new list with all indices and data as
in a and b. Note that this can cause a list or mapping to contain
several equal indices. Also, when adding a string to an int or float
the number is converted to a printable string first.
EXAMPLES
"a"+10 returns "a10"
10+20 returns 30
({1})+({2}) returns ({1,2})
(<1>)+(<1>) returns (<1,1>)
`+(2,2,2) returns 6
KEYWORDS
operator
SEE ALSO
`-, `*
NAME
`<< - shift left
SYNTAX
a << b
or
int `<<(int a, int b)
DESCRIPTION
This operator shift the integer a b steps left. This is equal to
multiplying a by 2 b times.
KEYWORDS
operator
SEE ALSO
`>>
NAME
`>> - shift right
SYNTAX
a >> b
or
int `>>(int a, int b)
DESCRIPTION
This operator shift the integer a b steps right. This is equal to
dividing a by 2 b times.
KEYWORDS
operator
SEE ALSO
`<<
NAME
`^ - exclusive or
SYNTAX
a ^ b
or
mixed `^(mixed ... args)
DESCRIPTION
This operator does logical exclusive or operations For ints this means
bitwise xor.
Arrays and lists are treated as sets, so xoring two arrays will
result in an array with containing all values present in either but
not both arrays.
For mappings, the intersection will be done on the indexes solely,
however, the values will be taken from the rightmost mapping.
KEYWORDS
operator
SEE ALSO
`|, `&
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment