--- a/progs/lecture5.scala Sat Mar 11 23:24:15 2023 +0000
+++ b/progs/lecture5.scala Sat Sep 23 23:49:44 2023 +0100
@@ -271,7 +271,7 @@
// This is called "strict evaluation".
-// On the contrary, say we have a pretty expensive operation:
+// In contrast say we have a pretty expensive operation:
def peop(n: BigInt): Boolean = peop(n + 1)
@@ -394,8 +394,8 @@
enuml(1, "a")
enuml(1, "a").size
enuml(2, "a").size
-enuml(3, "a").size // out of heap space
-
+enuml(3, "a").size
+enuml(4, "a").size // out of heap space
def enum(rs: LazyList[Rexp]) : LazyList[Rexp] =
@@ -405,7 +405,7 @@
enum(LazyList(ZERO, ONE, CHAR('a'), CHAR('b'))).take(200).force
-enum(LazyList(ZERO, ONE, CHAR('a'), CHAR('b'))).take(5_000_000).force
+enum(LazyList(ZERO, ONE, CHAR('a'), CHAR('b'))).take(5_000_000).force // out of memory
def depth(r: Rexp) : Int = r match {