From: Jim Pryor Date: Tue, 26 Oct 2010 14:26:07 +0000 (-0400) Subject: Revert "Revert "ass5: omega->blackhole"" X-Git-Url: http://lambda.jimpryor.net/git/gitweb.cgi?p=lambda.git;a=commitdiff_plain;h=7cad312dc0302b90657d253d2fc2e579485865d0 Revert "Revert "ass5: omega->blackhole"" This reverts commit f91578902b8306ab3e52fb172637405cb8e3fb42. --- diff --git a/assignment5.mdwn b/assignment5.mdwn index 61096c4e..02c0ac4d 100644 --- a/assignment5.mdwn +++ b/assignment5.mdwn @@ -35,38 +35,38 @@ Types and OCaml 2. Throughout this problem, assume that we have - let rec omega x = omega x;; + let rec blackhole x = blackhole x;; All of the following are well-typed. Which ones terminate? What are the generalizations? - omega;; + blackhole;; - omega ();; + blackhole ();; - fun () -> omega ();; + fun () -> blackhole ();; - (fun () -> omega ()) ();; + (fun () -> blackhole ()) ();; - if true then omega else omega;; + if true then blackhole else blackhole;; - if false then omega else omega;; + if false then blackhole else blackhole;; - if true then omega else omega ();; + if true then blackhole else blackhole ();; - if false then omega else omega ();; + if false then blackhole else blackhole ();; - if true then omega () else omega;; + if true then blackhole () else blackhole;; - if false then omega () else omega;; + if false then blackhole () else blackhole;; - if true then omega () else omega ();; + if true then blackhole () else blackhole ();; - if false then omega () else omega ();; + if false then blackhole () else blackhole ();; - let _ = omega in 2;; + let _ = blackhole in 2;; - let _ = omega () in 2;; + let _ = blackhole () in 2;; 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, - let rec omega x = omega x in - if true then omega else omega ();; + let rec blackhole x = blackhole x in + if true then blackhole else blackhole ();; terminates, but - let rec omega x = omega x in + let rec blackhole x = blackhole x in let b = true in - let y = omega in - let n = omega () in + let y = blackhole in + let n = blackhole () in match b with true -> y | false -> n;; does not terminate. Incidentally, `match bool with true -> yes |