--- a/progs/lecture1.scala Thu Nov 10 04:02:45 2016 +0000
+++ b/progs/lecture1.scala Thu Nov 10 10:40:05 2016 +0000
@@ -20,8 +20,9 @@
(1 until 10).toList
// an element in a list
-List(1, 2, 3, 1)(0)
-List(1, 2, 3, 1)(3)
+val lst = List(1, 2, 3, 1)
+lst(0)
+lst(2)
1::2::3::Nil
List(1, 2, 3) ::: List(4, 5, 6)
@@ -31,8 +32,7 @@
println("test")
-
-val tst = "This is a " ++ "test\n"
+val tst = "This is a " + "test\n"
println(tst)
val lst = List(1,2,3,1)
@@ -40,6 +40,8 @@
println(lst.toString)
println(lst.mkString("\n"))
+println(lst.mkString(", "))
+
// some methods take more than one argument
println(lst.mkString("[", ",", "]"))