--- a/progs/lecture5.scala Tue Dec 03 01:58:19 2019 +0000
+++ b/progs/lecture5.scala Tue Dec 03 11:07:09 2019 +0000
@@ -21,7 +21,7 @@
def peop(n: BigInt): Boolean = peop(n + 1)
val a = "foo"
-val b = "foo"
+val b = "bar"
if (a == b || peop(0)) println("true") else println("false")
@@ -31,6 +31,7 @@
// does not need to be re-calculated.
// A useful example is
+
def time_needed[T](i: Int, code: => T) = {
val start = System.nanoTime()
for (j <- 1 to i) code
@@ -156,7 +157,7 @@
enum(LazyList(ZERO, ONE, CHAR('a'), CHAR('b'))).take(200).force
-enum(LazyList(ZERO, ONE, CHAR('a'), CHAR('b'))).take(5000000)
+enum(LazyList(ZERO, ONE, CHAR('a'), CHAR('b'))).take(5_000_000)
val is =
@@ -165,6 +166,7 @@
.take(10).foreach(println))
+
// Polymorphic Types
//===================
@@ -539,6 +541,17 @@
//
// http://www.latkin.org/blog/2017/05/02/when-the-scala-compiler-doesnt-help/
+val two = 0.2
+val one = 0.1
+val eight = 0.8
+val six = 0.6
+
+two - one == one
+eight - six == two
+
+
+
+
List(1, 2, 3).contains("your cup")