git @ Cat's Eye Technologies Lariat / fb38023
Implemented but untested Chris Pressey 3 years ago
2 changed file(s) with 21 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
270270 let
271271 s = reduce(v)
272272 in
273 [s[0], app(u, s[1])],
273 if s[0] then
274 [true, app(u, s[1])]
275 else
276 [false, app(r[1], s[1])],
274277 fun(t) -> [false, t]
275278 )
276279
100100 testIsBeta1 = (isBetaReducible testApp) == True
101101 testIsBeta2 = (isBetaReducible testAbs) == False
102102 testIsBeta3 = (isBetaReducible (var "j")) == False
103
104 reduceOneTerm t =
105 if isBetaReducible t then (Right (beta t)) else destruct t
106 (\n -> Left (var n))
107 (\u v ->
108 case reduceOneTerm u of
109 Right r -> Right (app r v)
110 Left f ->
111 case reduceOneTerm v of
112 Right s -> Right (app u s)
113 Left g -> Left (app f g)
114 )
115 (\u -> Left u)
116
117 --
118 -- TODO: tests for that
119 --