refactor: extract Reducer interface and update engine to use abstractions #31
Reference in New Issue
Block a user
Delete Branch "refactor/reducer-interface"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Description
This PR builds on #30 to complete the abstraction layer for multi-mode evaluation support.
The engine now accepts abstract
expr.Expressionandreducer.Reducertypes instead of concrete lambda types.pkg/reducer/reducer.gowithReducerinterface definingReduce(expr.Expression, onStep) expr.Expression.pkg/lambda/reducer.gowithNormalOrderReducerthat wraps the existingReduceAlllogic.engine.Engineto storeexpr.Expressionandreducer.Reducerinstead of*lambda.Expression.expr.Expression.String()directly (no pointer dereference needed).NormalOrderReducerand pass it to the engine.Decisions
Reducer.Reducemethod returns the final expression and callsonStepafter each reduction step with the current state.NormalOrderReducertype-asserts tolambda.Expressioninternally; other expression types are returned unchanged.Expressionfield both during reduction (viaonStep) and after completion.Benefits
expr.Expressionandreducer.Reducer.expr.Expression.Checklist
<type>/<description>).Closes #30