projects
/
lambda.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
1228661
)
Revert "ass5: omega->blackhole"
author
Jim Pryor
<profjim@jimpryor.net>
Tue, 26 Oct 2010 14:20:44 +0000
(10:20 -0400)
committer
Jim Pryor
<profjim@jimpryor.net>
Tue, 26 Oct 2010 14:20:44 +0000
(10:20 -0400)
This reverts commit
0d85c76d0d37b32bf99483b86828a7d2829db44e
.
assignment5.mdwn
patch
|
blob
|
history
diff --git
a/assignment5.mdwn
b/assignment5.mdwn
index
02c0ac4
..
61096c4
100644
(file)
--- a/
assignment5.mdwn
+++ b/
assignment5.mdwn
@@
-35,38
+35,38
@@
Types and OCaml
2. Throughout this problem, assume that we have
2. Throughout this problem, assume that we have
- let rec
blackhole x = blackhole
x;;
+ let rec
omega x = omega
x;;
All of the following are well-typed.
Which ones terminate? What are the generalizations?
All of the following are well-typed.
Which ones terminate? What are the generalizations?
-
blackhole
;;
+
omega
;;
-
blackhole
();;
+
omega
();;
- fun () ->
blackhole
();;
+ fun () ->
omega
();;
- (fun () ->
blackhole
()) ();;
+ (fun () ->
omega
()) ();;
- if true then
blackhole else blackhole
;;
+ if true then
omega else omega
;;
- if false then
blackhole else blackhole
;;
+ if false then
omega else omega
;;
- if true then
blackhole else blackhole
();;
+ if true then
omega else omega
();;
- if false then
blackhole else blackhole
();;
+ if false then
omega else omega
();;
- if true then
blackhole () else blackhole
;;
+ if true then
omega () else omega
;;
- if false then
blackhole () else blackhole
;;
+ if false then
omega () else omega
;;
- if true then
blackhole () else blackhole
();;
+ if true then
omega () else omega
();;
- if false then
blackhole () else blackhole
();;
+ if false then
omega () else omega
();;
- let _ =
blackhole
in 2;;
+ let _ =
omega
in 2;;
- let _ =
blackhole
() in 2;;
+ let _ =
omega
() in 2;;
3. This problem is to begin thinking about controlling order of evaluation.
The following expression is an attempt to make explicit the
3. This problem is to begin thinking about controlling order of evaluation.
The following expression is an attempt to make explicit the
@@
-104,15
+104,15
@@
and that "bool" is any boolean. Then we can try the following:
However,
However,
- let rec
blackhole x = blackhole
x in
- if true then
blackhole else blackhole
();;
+ let rec
omega x = omega
x in
+ if true then
omega else omega
();;
terminates, but
terminates, but
- let rec
blackhole x = blackhole
x in
+ let rec
omega x = omega
x in
let b = true in
let b = true in
- let y =
blackhole
in
- let n =
blackhole
() in
+ let y =
omega
in
+ let n =
omega
() in
match b with true -> y | false -> n;;
does not terminate. Incidentally, `match bool with true -> yes |
match b with true -> y | false -> n;;
does not terminate. Incidentally, `match bool with true -> yes |