Permalink
Browse files

Match eval order

  • Loading branch information...
1 parent 5e04de4 commit ef3499190d6a4b30eadfc9ff5eebf61c9cb35f0b @tomykaira committed Mar 18, 2012
Showing with 2 additions and 1 deletion.
  1. +2 −1 eval.ml
View
@@ -56,9 +56,10 @@ let rec eval e env =
| Let (x, v, e) -> eval e (ext env x (eval v env))
| Fun (x, e) -> FunVal(x, e, env)
| App (e1, e2) ->
+ let arg = (eval e2 env) in (* ocaml と評価順をあわせる *)
(match eval e1 env with
| FunVal (param, body, env1) ->
- eval body (ext env1 param (eval e2 env))
+ eval body (ext env1 param arg)
| _ -> failwith "function value expected")
| _ -> failwith "unknown expression"

0 comments on commit ef34991

Please sign in to comment.