Operators — Mapanare

Arithmetic, comparison, logical, pipe, send, and matrix multiplication.

Arithmetic

+ Add, - Subtract, * Multiply, / Divide, % Modulo, @ Matrix multiply, -x Negate.

Comparison

== Equal, != Not equal, < Less than, > Greater than, <= Less or equal, >= Greater or equal.

Logical

&& AND (short-circuit), || OR (short-circuit), ! NOT.

Pipe Operator

The |> operator passes the left-hand value as the first argument to the right-hand function:

let result = data |> filter(x => x > 0) |> map(x => x * 2) |> fold(0, (acc, x) => acc + x)

Send Operator

The <- operator sends a message to an agent's input channel (non-blocking).

Error Propagation

The postfix ? unwraps a Result or Option, returning early on error.

Namespace Access

The :: operator accesses static methods and module members: Math::sqrt(2.0)

Precedence (lowest to highest)

1: => lambda, 2: = += -= *= /= <- assignment/send, 3: ||, 4: &&, 5: == !=, 6: < > <= >=, 7: |> pipe, 8: .. ..= range, 9: + -, 10: * / % @, 11: - ! unary, 12: . () [] ? postfix.