--- a/Fahad/CodeSamples/SequenceComprehensions.scala Wed Nov 12 12:24:26 2014 +0000
+++ b/Fahad/CodeSamples/SequenceComprehensions.scala Tue Dec 09 16:17:41 2014 +0000
@@ -1,3 +1,17 @@
+
+case class Twice(i: Int) {
+ def apply(x: Int, y: Int): Int = x * y
+ //def unapply(z: Int): Option[Int] = if (z % 2 == 0) Some(z/2) else None
+}
+
+Twice(21) match {
+ case Twice(n) => println(n)
+}
+
+Twice(21, 3) match {
+ case Twice(n) => println(n)
+}
+
package Main
@@ -26,4 +40,4 @@
i <- Iterator.range(0, 20);
j <- Iterator.range(i + 1, 20) if i + j == 32
) println("(" + i + ", " + j + ")")
-}
\ No newline at end of file
+}