github.com/lmorg/murex@v0.0.0-20240217211045-e081c89cd4ef/builtins/core/expressions/expressions_doc.yaml (about)

     1  - DocumentID: expr
     2    Title: >+
     3      `expr`
     4    CategoryID: commands
     5    Summary: >-
     6      Expressions: mathematical, string comparisons, logical operators
     7    Description: |-
     8      `expr` is the underlying builtin which handles all expression parsing and
     9      evaluation in Murex. Though typically that would happen transparently without
    10      you having to explicit call `expr`.
    11  
    12      For a full list of operators supported exclusively in expression, see the
    13      last section in this document.
    14    Usage: |-
    15      ```
    16      expression -> <stdout>
    17  
    18      statement (expression)
    19  
    20      expr expression -> <stdout>
    21      ```
    22    Examples: |-
    23      **Expressions:**
    24  
    25      ```
    26      » 3 * (3 + 1)
    27      12
    28      ```
    29  
    30      **Statements with inlined expressions:**
    31  
    32      Any parameter surrounded by parenthesis is first evaluated as an expression,
    33      then as a string.
    34  
    35      ```
    36      » out (3 * 2)
    37      6
    38      ```
    39  
    40      **Expressions with inlined statements:**
    41  
    42      Functions can be inlined as a statement using `function(parameters...)` syntax.
    43  
    44      ```
    45      » datetime(--in {now} --out {unix}) / 60
    46      28339115.783333335
    47      ```
    48  
    49      Please note that currently the only functions supported are ones who's names
    50      are comprised entirely of alpha, numeric, underscore and/or exclamation marks.
    51  
    52      **JSON array:**
    53  
    54      ```
    55      » %[apples oranges grapes]
    56      [
    57          "apples",
    58          "oranges",
    59          "grapes"
    60      ]
    61      ```
    62    Detail: |-
    63      ### Order of Operations
    64  
    65      The order of operations follows the same rules as the C programming language,
    66      which itself is an extension of the order of operations in mathematics, often
    67      referred to as PEMDAS or MODMAS ([read more](https://en.wikipedia.org/wiki/Order_of_operations)).
    68  
    69      The [Wikipedia article](https://en.wikipedia.org/wiki/Order_of_operations#Programming_languages)
    70      summarises that order succinctly however the detailed specification is defined
    71      by its implementation, as seen in the code below:
    72  
    73      ```go
    74      {{ include "lang/expressions/expression.go" }}
    75      ```
    76    Synonyms:
    77    Related:
    78      - addition
    79      - subtraction
    80      - multiplication
    81      - division
    82      - add-with
    83      - subtract-by
    84      - multiply-by
    85      - divide-by
    86      - elvis
    87      - null-coalescing
    88      - create-array
    89      - create-object