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

@@ -19,5 +19,5 @@ func NewLogs(logger *slog.Logger, process *engine.Engine) *Logs {
}
func (t *Logs) Step() {
t.logger.Info("reduction", "tree", (*t.process.Expression).String())
t.logger.Info("reduction", "tree", t.process.Expression.String())
}