aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Reducer.hs
diff options
context:
space:
mode:
authorMarvin Borner2022-04-24 15:45:39 +0200
committerMarvin Borner2022-04-24 15:45:39 +0200
commitb2cca2c5584ee92a2fbd006ca7d33f4dddec7d93 (patch)
treeb7a2b54cbc1184b80cf0e1e6387b6b54b9688b0b /src/Reducer.hs
parent3b90d4f15ebad7dc15d78195397559bcca3bd8fb (diff)
Tests
Diffstat (limited to 'src/Reducer.hs')
-rw-r--r--src/Reducer.hs4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/Reducer.hs b/src/Reducer.hs
index 809687b..a7c544a 100644
--- a/src/Reducer.hs
+++ b/src/Reducer.hs
@@ -20,11 +20,11 @@ bind :: Expression -> Expression -> Int -> Expression
bind exp (Bruijn x) n = if x == n then exp else Bruijn x
bind exp (Application exp1 exp2) n =
Application (bind exp exp1 n) (bind exp exp2 n)
-bind exp (Abstraction exp') n = Abstraction (bind (exp <-> 0) exp' (succ n))
+bind exp (Abstraction exp') n = Abstraction (bind (exp <-> (-1)) exp' (succ n))
step :: Expression -> Expression
step (Bruijn exp ) = Bruijn exp
-step (Application (Abstraction exp) app ) = (bind (app <-> 0) exp 0) <+> 0
+step (Application (Abstraction exp) app ) = (bind (app <-> (-1)) exp 0) <+> 0
step (Application exp1 exp2) = Application (step exp1) (step exp2)
step (Abstraction exp ) = Abstraction (step exp)