A slope module for performing calculation with infix math (instead of prefix)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
sloum 9088fde2c1 Updates to namespace support 2 weeks ago
README.md Updates to namespace support 2 weeks ago
main.slo Updates to namespace support 2 weeks ago
module.json Updates to namespace support 2 weeks ago

README.md

infix-math

infix-math is a slope module for making infix calculations. It supports variable substitution within calculation strings.

Usage

The infix-calc procedure is used to calculate the given problem. It has the following procedures signature:

(infix-calc [problem: string|list] [[variables: assoc]]) ; => number

Example Usage

(load-mod infix-math)
(define problem "1 + -2 * ($X + 1)")
(infix-math::calc problem [["$X" 5]])
; => -11

(infix-calc [1 '+ -2 '* "(" 5 '+ 1 ")"])
; => -11

Supported Operations

At present +, -, *, /, and parens (( and )) are supported. For both integers and 64 bit floating point numbers.