evaluate
Evaluate RPN expressions using arithmetic operators and stack commands. Returns the computed result or full stack when requested.
Instructions
Evaluate an RPN (Reverse Polish Notation) expression.
Operators: +, -, *, /, **, % (add, subtract, multiply, divide, power, modulo). Commands: clear (clear stack), dup (duplicate top), swap (swap top two). Example: '3 4 +' returns 7
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| expression | Yes | Space-separated RPN expression (e.g., "3 4 +"). | |
| show_stack | No | Whether to return full stack after evaluation (default: False). |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |