feat: reducer, but doesn`t work
This commit is contained in:
19
pkg/lambda/rename.go
Normal file
19
pkg/lambda/rename.go
Normal file
@@ -0,0 +1,19 @@
|
||||
package lambda
|
||||
|
||||
func Rename(e Expression, target string, substitute string) {
|
||||
switch e := e.(type) {
|
||||
case *Variable:
|
||||
if e.Value == target {
|
||||
e.Value = substitute
|
||||
}
|
||||
case *Abstraction:
|
||||
if e.Parameter == target {
|
||||
e.Parameter = substitute
|
||||
}
|
||||
|
||||
Rename(e.Body, target, substitute)
|
||||
case *Application:
|
||||
Rename(e.Abstraction, target, substitute)
|
||||
Rename(e.Argument, target, substitute)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user