From d581508465c1e3523321c4867d66ec1691891cee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20H=C3=BCbinette=20=28Hubbe=29?= <hubbe@hubbe.net> Date: Sun, 25 Feb 1996 21:41:51 +0100 Subject: [PATCH] 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 --- doc/operators/and | 24 +++++++++++++++++++++ doc/operators/complement | 17 +++++++++++++++ doc/operators/divide | 31 ++++++++++++++++++++++++++ doc/operators/is_equal | 19 ++++++++++++++++ doc/operators/is_greater_or_equal | 17 +++++++++++++++ doc/operators/is_greater_than | 17 +++++++++++++++ doc/operators/is_lesser_or_equal | 17 +++++++++++++++ doc/operators/is_lesser_than | 17 +++++++++++++++ doc/operators/minus | 36 +++++++++++++++++++++++++++++++ doc/operators/modulo | 26 ++++++++++++++++++++++ doc/operators/mult | 30 ++++++++++++++++++++++++++ doc/operators/not | 13 +++++++++++ doc/operators/not_equal | 19 ++++++++++++++++ doc/operators/or | 24 +++++++++++++++++++++ doc/operators/plus | 28 ++++++++++++++++++++++++ doc/operators/shift_left | 17 +++++++++++++++ doc/operators/shift_right | 17 +++++++++++++++ doc/operators/xor | 24 +++++++++++++++++++++ 18 files changed, 393 insertions(+) create mode 100644 doc/operators/and create mode 100644 doc/operators/complement create mode 100644 doc/operators/divide create mode 100644 doc/operators/is_equal create mode 100644 doc/operators/is_greater_or_equal create mode 100644 doc/operators/is_greater_than create mode 100644 doc/operators/is_lesser_or_equal create mode 100644 doc/operators/is_lesser_than create mode 100644 doc/operators/minus create mode 100644 doc/operators/modulo create mode 100644 doc/operators/mult create mode 100644 doc/operators/not create mode 100644 doc/operators/not_equal create mode 100644 doc/operators/or create mode 100644 doc/operators/plus create mode 100644 doc/operators/shift_left create mode 100644 doc/operators/shift_right create mode 100644 doc/operators/xor diff --git a/doc/operators/and b/doc/operators/and new file mode 100644 index 0000000000..2099f48fca --- /dev/null +++ b/doc/operators/and @@ -0,0 +1,24 @@ +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 + `|, `^ diff --git a/doc/operators/complement b/doc/operators/complement new file mode 100644 index 0000000000..0c9ff65f25 --- /dev/null +++ b/doc/operators/complement @@ -0,0 +1,17 @@ +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 diff --git a/doc/operators/divide b/doc/operators/divide new file mode 100644 index 0000000000..82cb262e93 --- /dev/null +++ b/doc/operators/divide @@ -0,0 +1,31 @@ +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 + `*, `% diff --git a/doc/operators/is_equal b/doc/operators/is_equal new file mode 100644 index 0000000000..12653faeca --- /dev/null +++ b/doc/operators/is_equal @@ -0,0 +1,19 @@ +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 diff --git a/doc/operators/is_greater_or_equal b/doc/operators/is_greater_or_equal new file mode 100644 index 0000000000..1f744793f8 --- /dev/null +++ b/doc/operators/is_greater_or_equal @@ -0,0 +1,17 @@ +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 + `!=, `==, `>, `<, `<= diff --git a/doc/operators/is_greater_than b/doc/operators/is_greater_than new file mode 100644 index 0000000000..84ddca8473 --- /dev/null +++ b/doc/operators/is_greater_than @@ -0,0 +1,17 @@ +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 + `!=, `==, `<, `<=, `>= diff --git a/doc/operators/is_lesser_or_equal b/doc/operators/is_lesser_or_equal new file mode 100644 index 0000000000..e6956a73c6 --- /dev/null +++ b/doc/operators/is_lesser_or_equal @@ -0,0 +1,17 @@ +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 + `!=, `==, `>, `<, `>= diff --git a/doc/operators/is_lesser_than b/doc/operators/is_lesser_than new file mode 100644 index 0000000000..0482284764 --- /dev/null +++ b/doc/operators/is_lesser_than @@ -0,0 +1,17 @@ +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 + `!=, `==, `>, `<=, `>= diff --git a/doc/operators/minus b/doc/operators/minus new file mode 100644 index 0000000000..8bb403bf52 --- /dev/null +++ b/doc/operators/minus @@ -0,0 +1,36 @@ +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 + `+ diff --git a/doc/operators/modulo b/doc/operators/modulo new file mode 100644 index 0000000000..6e9561ea8d --- /dev/null +++ b/doc/operators/modulo @@ -0,0 +1,26 @@ +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 + `/, `* diff --git a/doc/operators/mult b/doc/operators/mult new file mode 100644 index 0000000000..e0ad0603e9 --- /dev/null +++ b/doc/operators/mult @@ -0,0 +1,30 @@ +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 + `/ diff --git a/doc/operators/not b/doc/operators/not new file mode 100644 index 0000000000..1c251ee35f --- /dev/null +++ b/doc/operators/not @@ -0,0 +1,13 @@ +NAME + `! - is not true + +SYNTAX + ! a + or + int `!(mixed a) + +DESCRIPTION + Returns 1 if a is zero, 0 otherwise. + +KEYWORDS + operator diff --git a/doc/operators/not_equal b/doc/operators/not_equal new file mode 100644 index 0000000000..d68f40d3d1 --- /dev/null +++ b/doc/operators/not_equal @@ -0,0 +1,19 @@ +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 diff --git a/doc/operators/or b/doc/operators/or new file mode 100644 index 0000000000..9985a3860c --- /dev/null +++ b/doc/operators/or @@ -0,0 +1,24 @@ +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 + `&, `^ diff --git a/doc/operators/plus b/doc/operators/plus new file mode 100644 index 0000000000..6402ad168a --- /dev/null +++ b/doc/operators/plus @@ -0,0 +1,28 @@ +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 + `-, `* diff --git a/doc/operators/shift_left b/doc/operators/shift_left new file mode 100644 index 0000000000..a354ad32db --- /dev/null +++ b/doc/operators/shift_left @@ -0,0 +1,17 @@ +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 + `>> diff --git a/doc/operators/shift_right b/doc/operators/shift_right new file mode 100644 index 0000000000..363e77d63f --- /dev/null +++ b/doc/operators/shift_right @@ -0,0 +1,17 @@ +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 + `<< diff --git a/doc/operators/xor b/doc/operators/xor new file mode 100644 index 0000000000..fe9d4e2676 --- /dev/null +++ b/doc/operators/xor @@ -0,0 +1,24 @@ +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 + `|, `& -- GitLab