projects
/
lambda.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
edits
[lambda.git]
/
code
/
untyped_evaluator.ml
diff --git
a/code/untyped_evaluator.ml
b/code/untyped_evaluator.ml
index
50092fb
..
5ccecb5
100644
(file)
--- a/
code/untyped_evaluator.ml
+++ b/
code/untyped_evaluator.ml
@@
-1,5
+1,5
@@
(*
(*
- This is a simplified version of the code at
...
+ This is a simplified version of the code at
http://lambda.jimpryor.net/code/untyped_full-1.7.tgz
You can use this code as follows:
1. First, use a text editor to fill in the (* COMPLETE THIS *) portions.
You can use this code as follows:
1. First, use a text editor to fill in the (* COMPLETE THIS *) portions.
@@
-15,7
+15,7
@@
`reduce (App(Lambda("x",Var "x"),Lambda("y",Var "y")))`
`evaluate (App(Lambda("x",Var "x"),Lambda("y",Var "y")))`
`reduce (App(Lambda("x",Var "x"),Lambda("y",Var "y")))`
`evaluate (App(Lambda("x",Var "x"),Lambda("y",Var "y")))`
- The two interpreters presented below are (VersionA) a substitute-and-rep
lace
+ The two interpreters presented below are (VersionA) a substitute-and-rep
eat
interpreter, and (VersionB) an environment-based interpreter. We discuss the
differences between these in the course notes.
interpreter, and (VersionB) an environment-based interpreter. We discuss the
differences between these in the course notes.
@@
-61,7
+61,7
@@
and env = (identifier * term) list
(* Operations for environments *)
let empty = []
let shift (ident : identifier) binding env = (ident,binding) :: env
(* Operations for environments *)
let empty = []
let shift (ident : identifier) binding env = (ident,binding) :: env
-let rec lookup (sought_ident : ident) (env : env) : term option =
+let rec lookup (sought_ident : ident
ifier
) (env : env) : term option =
match env with
| [] -> None
| (ident, binding) :: _ when ident = sought_ident -> Some binding
match env with
| [] -> None
| (ident, binding) :: _ when ident = sought_ident -> Some binding