Change ordering on lammbda_calculus example
This commit is contained in:
parent
930bcc9bba
commit
d2a1ca97d7
1 changed files with 9 additions and 8 deletions
|
|
@ -24,6 +24,15 @@ insert : Char -> Val -> Cxt -> Cxt
|
|||
insert x v cxt = case cxt of
|
||||
Cxt ps => Cxt (Cons (Pair x v) ps)
|
||||
|
||||
|
||||
-- (λx. x + x) 200
|
||||
exp = EApp
|
||||
(EAbs 'x'
|
||||
(EAdd
|
||||
(EVar 'x')
|
||||
(EVar 'x')))
|
||||
(EInt 200)
|
||||
|
||||
eval : Cxt -> Exp -> Val
|
||||
eval cxt exp = case exp of
|
||||
EAbs x e => VClosure cxt x e
|
||||
|
|
@ -39,14 +48,6 @@ eval cxt exp = case exp of
|
|||
let i2 = case eval cxt e2 of { VInt i => i } in
|
||||
VInt (i1 + i2)
|
||||
|
||||
-- (λx. x + x) 200
|
||||
exp = EApp
|
||||
(EAbs 'x'
|
||||
(EAdd
|
||||
(EVar 'x')
|
||||
(EVar 'x')))
|
||||
(EInt 200)
|
||||
|
||||
main : Int
|
||||
main = case eval (Cxt Nil) exp of
|
||||
VInt i => i
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue