refactor: extract Reducer interface and update engine to use abstractions

Introduce reducer.Reducer interface and update the engine to use abstract
expr.Expression and reducer.Reducer types, enabling pluggable reduction
strategies.

- Add pkg/reducer/reducer.go with Reducer interface.
- Add pkg/lambda/reducer.go with NormalOrderReducer implementation.
- Update engine to accept expr.Expression and reducer.Reducer.
- Update plugins to use expr.Expression directly (no pointer dereference).
- Update main and tests to pass reducer to engine.

Closes #30
This commit is contained in:
2026-01-16 18:40:17 -05:00
parent e0114c736d
commit a61809ad1d
7 changed files with 71 additions and 16 deletions

View File

@@ -23,9 +23,9 @@ func NewExplanation(process *engine.Engine) *Explanation {
}
func (t *Explanation) Start() {
fmt.Println((*t.process.Expression).String())
fmt.Println(t.process.Expression.String())
}
func (t *Explanation) Step() {
fmt.Println(" =", (*t.process.Expression).String())
fmt.Println(" =", t.process.Expression.String())
}