feat: stuff
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user