From 0b33fd48b6a867f3e564e3aa922a1c7da36acd33 Mon Sep 17 00:00:00 2001 From: "Heinz N. Gies" Date: Mon, 25 Sep 2023 16:29:36 +0200 Subject: [PATCH 1/2] Document fold operations for functions Signed-off-by: Heinz N. Gies --- docs/language/expressions.md | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/docs/language/expressions.md b/docs/language/expressions.md index 4b358556..55aacdf3 100644 --- a/docs/language/expressions.md +++ b/docs/language/expressions.md @@ -243,20 +243,22 @@ See also: List of binary and unary operators in Tremor, ordered by precedence (from low to high): -| Symbol | Name | Example | Types | -|--------------|-------------------------------------------------------|---------------------------------------------------------|--------------------------------| -| or | Logical OR | `true or false` | bool | -| and | Logical AND | `true and false` | bool | -| \| | Bitwise OR | _Bitwise OR has not been implemented yet_ | - | -| ^ | Bitwise XOR | `42 ^ 42, true ^ true` | integer, bool | -| & | Bitwise AND | `42 & 0, true & false` | integer, bool | -| ==, != | Equality, Inequality | `"snot" != "badger"` | all | -| <, <=, >, >= | Comparison Operators | `42 > 0` | integer, float, string, binary | -| <<, >>, >>> | Bitwise shift -- Left, Right(signed), Right(unsigned) | `42 >> 2` | integer | -| +, - | Addition, Subtraction | `42 + 0` | integer, float, string | -| \*, /, % | Multiplication, Division, Modulus | `42 * 1` | integer, float (no modulo) | -| +, - | Unary Plus, Unary Minus | `+42` | integer, float, string | -| not , ! | Unary Logical NOT, Unary Bitwise NOT | `not false`, _Bitwise NOT has not been implemented yet_ | bool | +| Symbol | Name | Example | Types | Fold Support | +|--------------|-----------------------------------------------|---------------------------------------------------------|--------------------------------|--------------| +| or | Logical OR | `true or false` | bool | no | +| and | Logical AND | `true and false` | bool | no | +| \| | Bitwise OR | _Bitwise OR has not been implemented yet_ | - | no | +| ^ | Bitwise XOR | `42 ^ 42, true ^ true` | integer, bool | yes | +| & | Bitwise AND | `42 & 0, true & false` | integer, bool | yes | +| ==, != | Equality, Inequality | `"snot" != "badger"` | all | no | +| <, <=, >, >= | Comparison Operators | `42 > 0` | integer, float, string, binary | no | +| <<, >>, >>> | Bitwise shift: Left, Right(signed & unsigned) | `42 >> 2` | integer | no | +| + | Addition | `42 + 0` | all | yes | +| - | Subtraction | `42 - 0` | integer, float, string | yes | +| \*, / | Multiplication, Division | `42 * 1` | integer, float | yes | +| % | Modulus | `42 % 2` | integer | yes | +| +, - | Unary Plus, Unary Minus | `-42` | integer, float | no | +| not , ! | Unary Logical NOT, Unary Bitwise NOT | `not false`, _Bitwise NOT has not been implemented yet_ | bool | no | :::warning From 346480346effb86406b7c4cc5d51cd857f275ca2 Mon Sep 17 00:00:00 2001 From: "Heinz N. Gies" Date: Wed, 27 Sep 2023 11:30:18 +0200 Subject: [PATCH 2/2] Update operators Signed-off-by: Heinz N. Gies --- docs/language/expressions.md | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/docs/language/expressions.md b/docs/language/expressions.md index 55aacdf3..bd1e1d03 100644 --- a/docs/language/expressions.md +++ b/docs/language/expressions.md @@ -243,20 +243,25 @@ See also: List of binary and unary operators in Tremor, ordered by precedence (from low to high): +### Binary Operators + | Symbol | Name | Example | Types | Fold Support | |--------------|-----------------------------------------------|---------------------------------------------------------|--------------------------------|--------------| -| or | Logical OR | `true or false` | bool | no | -| and | Logical AND | `true and false` | bool | no | +| or | Logical OR (short circuiteing) | `true or false` | bool | yes | +| and | Logical AND (short circuiteing) | `true and false` | bool | yes | +| xor | Logical XOR | `true xor false` | bool | yes | | \| | Bitwise OR | _Bitwise OR has not been implemented yet_ | - | no | | ^ | Bitwise XOR | `42 ^ 42, true ^ true` | integer, bool | yes | | & | Bitwise AND | `42 & 0, true & false` | integer, bool | yes | | ==, != | Equality, Inequality | `"snot" != "badger"` | all | no | | <, <=, >, >= | Comparison Operators | `42 > 0` | integer, float, string, binary | no | -| <<, >>, >>> | Bitwise shift: Left, Right(signed & unsigned) | `42 >> 2` | integer | no | +| <<, >>, >>> | Bitwise shift: Left, Right(signed & unsigned) | `42 >> 2` | integer | yes | | + | Addition | `42 + 0` | all | yes | | - | Subtraction | `42 - 0` | integer, float, string | yes | | \*, / | Multiplication, Division | `42 * 1` | integer, float | yes | | % | Modulus | `42 % 2` | integer | yes | + +### Unary Operators | +, - | Unary Plus, Unary Minus | `-42` | integer, float | no | | not , ! | Unary Logical NOT, Unary Bitwise NOT | `not false`, _Bitwise NOT has not been implemented yet_ | bool | no |