$ show PaddiM8/kalker
Kalker is a multi-platform mathematical calculator implemented primarily in Rust. It provides a CLI with a REPL, a web component compiled to WebAssembly, and an Android mobile app via Capacitor. The core library (`kalk`) supports user-defined variables and functions, units, differentiation, integration, root finding, equation systems, matrices/vectors, complex numbers, and multiple number bases. The codebase is well-structured with a clear separation between parsing (lexer/parser), evaluation (interpreter), and a custom value system. It features extensive test files and integration tests for numerical methods. While the core numerical routines (tanh-sinh quadrature, Newton's method, Gaussian elimination) are tightly coupled to the interpreter, they are implemented with care and demonstrate non-trivial numerical analysis. The repository also includes build scripts for multiple targets and CI/CD pipelines.
The LLM identified 3 files worth highlighting for reuse:
Implements a generic symbol table for storing variables, functions, and units. Provides lookup, insertion, and scoping operations. The pattern is clean and could be extracted as a standalone symbol table module for other Rust projects needing scoped name resolution.
Contains implementations of numerical integration (tanh-sinh quadrature with fallback), differentiation (central difference), root finding (Newton's method), and equation system solving (Newton-Raphson with Jacobian estimation and Gaussian elimination). Although the functions currently depend on the interpreter for evaluation, the algorithmic logic is self-contained and could be extracted into a standalone numerical library with minimal adaptation.
Defines all built-in constants, unary/binary/vector functions with metadata (including angle unit handling). Uses lazy_static HashMaps with typed function info structs. The pattern provides a clean, extensible registry for defining domain-specific functions and could be reused in other projects that need a catalog of callable operations.