Eliminate redundant eager calls of elimLambda
This commit is contained in:
parent
82e29440b0
commit
ca7f09e2ac
@ -56,18 +56,15 @@ elimLambda = go
|
|||||||
go (SLambda (v:vs) body)
|
go (SLambda (v:vs) body)
|
||||||
| null vs = toSKI v (elimLambda body)
|
| null vs = toSKI v (elimLambda body)
|
||||||
| otherwise = elimLambda (SLambda [v] (SLambda vs body))
|
| otherwise = elimLambda (SLambda [v] (SLambda vs body))
|
||||||
go (SApp f g ) = SApp (elimLambda f) (elimLambda g)
|
go (SApp f g) = SApp (elimLambda f) (elimLambda g)
|
||||||
go (TStem t ) = TStem (elimLambda t)
|
|
||||||
go (TFork l r ) = TFork (elimLambda l) (elimLambda r)
|
|
||||||
go (SList x ) = SList (map elimLambda x)
|
|
||||||
go x = x
|
go x = x
|
||||||
|
|
||||||
toSKI x (SVar y)
|
toSKI x (SVar y)
|
||||||
| x == y = _I
|
| x == y = _I
|
||||||
| otherwise = SApp _K (SVar y)
|
| otherwise = SApp _K (SVar y)
|
||||||
toSKI x t@(SApp n u)
|
toSKI x t@(SApp n u)
|
||||||
| not (isFree x t) = SApp _K (SApp (elimLambda n) (elimLambda u))
|
| not (isFree x t) = SApp _K t
|
||||||
| otherwise = SApp (SApp _S (toSKI x (elimLambda n))) (toSKI x (elimLambda u))
|
| otherwise = SApp (SApp _S (toSKI x n)) (toSKI x u)
|
||||||
toSKI x t
|
toSKI x t
|
||||||
| not (isFree x t) = SApp _K t
|
| not (isFree x t) = SApp _K t
|
||||||
| otherwise = SApp (SApp _S (toSKI x t)) TLeaf
|
| otherwise = SApp (SApp _S (toSKI x t)) TLeaf
|
||||||
|
Loading…
x
Reference in New Issue
Block a user