feat: stuff

This commit is contained in:
2026-01-16 19:27:16 -05:00
parent d9639ecc2b
commit 8dc5d986fd
4 changed files with 10 additions and 10 deletions

View File

@@ -10,11 +10,11 @@ import (
// for lambda calculus expressions.
type NormalOrderReducer struct {
emitter.BaseEmitter[reducer.Event]
expression Expression
expression *Expression
}
// NewNormalOrderReducer creates a new normal order reducer.
func NewNormalOrderReducer(expression Expression) *NormalOrderReducer {
func NewNormalOrderReducer(expression *Expression) *NormalOrderReducer {
return &NormalOrderReducer{
BaseEmitter: *emitter.New[reducer.Event](),
expression: expression,
@@ -23,7 +23,7 @@ func NewNormalOrderReducer(expression Expression) *NormalOrderReducer {
// Expression returns the current expression state.
func (r *NormalOrderReducer) Expression() expr.Expression {
return r.expression
return *r.expression
}
func isViable(e *Expression) (*Abstraction, Expression, bool) {
@@ -42,7 +42,7 @@ func isViable(e *Expression) (*Abstraction, Expression, bool) {
// The expression must be a lambda.Expression; other types are returned unchanged.
func (r *NormalOrderReducer) Reduce() {
r.Emit(reducer.StartEvent)
it := NewIterator(&r.expression)
it := NewIterator(r.expression)
for !it.Done() {
if fn, arg, ok := isViable(it.Current()); !ok {