algebra
Algebraic Expression Parser and Evaluator
Summary
| Latest Version | 0.1.1 |
|---|---|
| License | CC0 |
| CI Status | Failing |
| Downloads | 0 |
| Last Indexed | 2026-08-26 06:47 |
Tags
Authors
- ijneb
Installation
nimble install algebra
choosenim install algebra
git clone https://github.com/refaqtor/nim-algebra
OS Compatibility
| Platform | Linux | macOS | Windows | FreeBSD | OpenBSD | NetBSD | Android | iOS | WASM | Embedded |
|---|---|---|---|---|---|---|---|---|---|---|
| algebra | ✓ | ✓ | ✓ | - | - | - | - | - | - | - |
Source
| Repository | https://github.com/refaqtor/nim-algebra |
|---|---|
| Homepage | https://github.com/refaqtor/nim-algebra |
| Documentation | View Documentation |
| Registry Source | nimble_official |
README
Algebra Parser & Evaluator
Example
import algebra
echo evaluate(expr"1.5+1.5")
#=> 3.0
echo evaluate(expr"a/ln(b)", {"a": 5.5, "b": 2.2})
#=> 6.975646720399666
echo evaluate(expr"sin(a)", "a", [0.0, 1.0, 2.0, 3.0, 4.0, 4.5])
#=> @[0.0, 0.8414709848078965, 0.9092974268256817, 0.1411200080598672, -0.7568024953079282, -0.977530117665097]
Parsing Details
- After a function name (e.g. sin, cos, ln, etc.), a left parenthesis (
() must always immediately follow. - The
exprprocedure returns the tokens after the Shunting-Yard algorithm is applied.