Developed a dual-purpose Read-Eval-Print Loop (REPL) system in Scala designed to handle complex mathematical operations for both standard integers and custom multisets. The project emphasizes the core principles of functional programming, including immutability, recursion, and advanced pattern matching.
The system consists of two distinct calculators sharing a common architectural base, allowing for seamless expression evaluation, variable binding, and automated algebraic simplification.
The project utilizes a modular inheritance structure where a generic base class manages the core logic, while specific implementations handle unique data types.
A key feature of the system is the simplification engine, which uses deep pattern matching to transform complex expression trees into their most efficient forms.
The engine applies a suite of reduction rules, such as identity properties and distributivity laws, to recursively clean the tree. By utilizing a bottom-up simplification tactic, the system ensures that even deeply nested redundant operations, like adding zero or multiplying by one, are fully resolved. This project highlights the power of functional dispatch in building robust, maintainable software tools.