--- a/progs/lecture2.scala Fri Nov 17 02:13:40 2017 +0000
+++ b/progs/lecture2.scala Fri Nov 17 09:13:03 2017 +0000
@@ -2,7 +2,7 @@
//=================
-// Overloaded math operations
+// the pain with overloaded math operations
(100 / 4)
@@ -265,6 +265,17 @@
// ...
+// an aside: partial application
+
+def add(a: Int)(b: Int) : Int = a + b
+
+sum(add(2), 0, 2)
+sum(add(10), 0, 2)
+
+def add2(a: Int, b: Int) : Int = a + b
+sum(x => add2(2, x), 0, 2)
+sum(x => add2(10, x), 0, 2)
+
// Function Composition
//======================
@@ -312,14 +323,6 @@
-// Type abbreviations
-//====================
-
-// some syntactic convenience
-
-type Pos = (int, Int)
-type Board = List[List[Int]]
-
// Implicits (Cool Feature)
@@ -530,6 +533,14 @@
time_needed(10, count_intersection2(A, B))
+// Type abbreviations
+//====================
+
+// some syntactic convenience
+
+type Pos = (int, Int)
+type Board = List[List[Int]]
+