| 51 |      1 | // Scala Lecture 1
 | 
|  |      2 | //=================
 | 
| 14 |      3 | 
 | 
| 26 |      4 | // Value assignments
 | 
| 123 |      5 | // (their names should be lower case)
 | 
| 199 |      6 | //====================================
 | 
| 21 |      7 | 
 | 
| 14 |      8 | val x = 42
 | 
|  |      9 | val y = 3 + 4
 | 
| 123 |     10 | val z = x / y
 | 
|  |     11 | 
 | 
|  |     12 | 
 | 
|  |     13 | // (you cannot reassign values: z = 9 will give an error)
 | 
| 14 |     14 | 
 | 
|  |     15 | 
 | 
| 125 |     16 | // Hello World
 | 
|  |     17 | //=============
 | 
|  |     18 | 
 | 
| 199 |     19 | // an example of a stand-alone Scala file
 | 
|  |     20 | // (in the assignments you must submit a plain Scala script)
 | 
| 125 |     21 | 
 | 
|  |     22 | object Hello extends App { 
 | 
|  |     23 |   println("hello world")
 | 
|  |     24 | }
 | 
|  |     25 | 
 | 
| 199 |     26 | // can then be called with
 | 
| 125 |     27 | //
 | 
|  |     28 | // $> scalac hello-world.scala
 | 
|  |     29 | // $> scala Hello
 | 
|  |     30 | //
 | 
|  |     31 | // $> java -cp /usr/local/src/scala/lib/scala-library.jar:. Hello
 | 
|  |     32 | 
 | 
|  |     33 | 
 | 
|  |     34 | 
 | 
| 25 |     35 | // Collections
 | 
|  |     36 | //=============
 | 
| 14 |     37 | List(1,2,3,1)
 | 
|  |     38 | Set(1,2,3,1)
 | 
|  |     39 | 
 | 
|  |     40 | 1 to 10
 | 
|  |     41 | (1 to 10).toList
 | 
|  |     42 | 
 | 
|  |     43 | (1 until 10).toList
 | 
|  |     44 | 
 | 
| 18 |     45 | // an element in a list
 | 
| 33 |     46 | val lst = List(1, 2, 3, 1)
 | 
|  |     47 | lst(0)
 | 
|  |     48 | lst(2)
 | 
| 18 |     49 | 
 | 
| 34 |     50 | // some alterative syntax for lists
 | 
|  |     51 | 
 | 
| 189 |     52 | 1 :: 2 :: 3 :: Nil
 | 
| 23 |     53 | List(1, 2, 3) ::: List(4, 5, 6)
 | 
| 14 |     54 | 
 | 
| 199 |     55 | // Equality is structural
 | 
|  |     56 | //========================
 | 
|  |     57 | val a = "Dave"
 | 
|  |     58 | val b = "Dave"
 | 
|  |     59 | 
 | 
|  |     60 | if (a == b) println("equal") else println("unequal")
 | 
|  |     61 | 
 | 
|  |     62 | Set(1,2,3) == Set(3,1,2)
 | 
|  |     63 | List(1,2,3) == List(3,1,2)
 | 
|  |     64 | 
 | 
|  |     65 | 
 | 
| 200 |     66 | // this applies to "concrete" values;
 | 
| 199 |     67 | // you cannot compare functions
 | 
|  |     68 | 
 | 
|  |     69 | 
 | 
| 25 |     70 | // Printing/Strings
 | 
|  |     71 | //==================
 | 
| 14 |     72 | 
 | 
|  |     73 | println("test")
 | 
| 15 |     74 | 
 | 
| 33 |     75 | val tst = "This is a " + "test\n" 
 | 
| 14 |     76 | println(tst)
 | 
|  |     77 | 
 | 
|  |     78 | val lst = List(1,2,3,1)
 | 
|  |     79 | 
 | 
|  |     80 | println(lst.toString)
 | 
|  |     81 | println(lst.mkString("\n"))
 | 
|  |     82 | 
 | 
| 33 |     83 | println(lst.mkString(", "))
 | 
|  |     84 | 
 | 
| 14 |     85 | // some methods take more than one argument
 | 
| 21 |     86 | println(lst.mkString("[", ",", "]"))
 | 
| 14 |     87 | 
 | 
| 32 |     88 | 
 | 
| 200 |     89 | 
 | 
| 25 |     90 | // Conversion methods
 | 
|  |     91 | //====================
 | 
| 14 |     92 | 
 | 
|  |     93 | List(1,2,3,1).toString
 | 
|  |     94 | List(1,2,3,1).toSet
 | 
|  |     95 | "hello".toList
 | 
|  |     96 | 1.toDouble
 | 
|  |     97 | 
 | 
| 25 |     98 | 
 | 
| 32 |     99 | // useful list methods
 | 
|  |    100 | 
 | 
|  |    101 | List(1,2,3,4).length
 | 
| 25 |    102 | List(1,2,3,4).reverse
 | 
| 32 |    103 | List(1,2,3,4).max
 | 
|  |    104 | List(1,2,3,4).min
 | 
|  |    105 | List(1,2,3,4).sum
 | 
|  |    106 | List(1,2,3,4).take(2).sum
 | 
|  |    107 | List(1,2,3,4).drop(2).sum
 | 
| 199 |    108 | List(1,2,3,4,3).indexOf(3)
 | 
| 32 |    109 | 
 | 
| 36 |    110 | "1,2,3,4,5".split(",").mkString("\n")
 | 
|  |    111 | "1,2,3,4,5".split(",3,").mkString("\n")
 | 
| 25 |    112 | 
 | 
| 200 |    113 | "abcdefg".startsWith("abc")
 | 
|  |    114 | 
 | 
|  |    115 | 
 | 
| 140 |    116 | // Types (slide)
 | 
| 200 |    117 | //===============
 | 
| 25 |    118 | 
 | 
|  |    119 | /* Scala is a strongly typed language
 | 
|  |    120 |  
 | 
| 34 |    121 |  * some base types
 | 
| 14 |    122 | 
 | 
| 25 |    123 |     Int, Long, BigInt, Float, Double
 | 
|  |    124 |     String, Char
 | 
|  |    125 |     Boolean
 | 
|  |    126 | 
 | 
| 34 |    127 |  * some compound types 
 | 
| 12 |    128 | 
 | 
| 25 |    129 |     List[Int],
 | 
|  |    130 |     Set[Double]
 | 
|  |    131 |     Pairs: (Int, String)        
 | 
|  |    132 |     List[(BigInt, String)]
 | 
| 200 |    133 |     Option[Int]
 | 
| 25 |    134 | */
 | 
| 12 |    135 | 
 | 
| 23 |    136 | 
 | 
| 14 |    137 | 
 | 
| 25 |    138 | // Pairs/Tuples
 | 
|  |    139 | //==============
 | 
| 14 |    140 | 
 | 
|  |    141 | val p = (1, "one")
 | 
|  |    142 | p._1
 | 
|  |    143 | p._2
 | 
|  |    144 | 
 | 
|  |    145 | val t = (4,1,2,3)
 | 
|  |    146 | t._4
 | 
|  |    147 | 
 | 
| 25 |    148 | 
 | 
| 200 |    149 | List(("one", 1), ("two", 2), ("three", 3))
 | 
|  |    150 | 
 | 
| 25 |    151 | // Function Definitions
 | 
|  |    152 | //======================
 | 
| 14 |    153 | 
 | 
| 123 |    154 | def incr(x: Int) : Int = x + 1
 | 
|  |    155 | def double(x: Int) : Int = x + x
 | 
|  |    156 | def square(x: Int) : Int = x * x
 | 
| 14 |    157 | 
 | 
| 25 |    158 | square(6)
 | 
| 21 |    159 | 
 | 
|  |    160 | 
 | 
| 36 |    161 | // The general scheme for a function: you have to give a type 
 | 
|  |    162 | // to each argument and a return type of the function
 | 
|  |    163 | //
 | 
|  |    164 | //  def fname(arg1: ty1, arg2: ty2,..., argn: tyn): rty = {
 | 
|  |    165 | //    body 
 | 
|  |    166 | //  }
 | 
|  |    167 | 
 | 
|  |    168 | 
 | 
| 200 |    169 | //
 | 
|  |    170 | // BTW: no returns!!
 | 
|  |    171 | // "last" line (expression) in a function determines the result
 | 
|  |    172 | //
 | 
|  |    173 | 
 | 
|  |    174 | def silly(n: Int) : Int = {
 | 
|  |    175 |   n * n
 | 
|  |    176 |   n + n
 | 
|  |    177 | }
 | 
|  |    178 | 
 | 
| 36 |    179 | 
 | 
| 123 |    180 | // If-Conditionals
 | 
|  |    181 | //=================
 | 
| 14 |    182 | 
 | 
| 200 |    183 | // - Scala does not have a then-keyword
 | 
|  |    184 | // - both if-else branches need to be present
 | 
| 189 |    185 | 
 | 
| 143 |    186 | def fact(n: Int) : Int = 
 | 
| 14 |    187 |   if (n == 0) 1 else n * fact(n - 1)
 | 
|  |    188 | 
 | 
| 36 |    189 | 
 | 
|  |    190 | fact(5)
 | 
|  |    191 | fact(150)
 | 
|  |    192 | 
 | 
| 25 |    193 | /* boolean operators
 | 
|  |    194 |  
 | 
|  |    195 |    ==     equals
 | 
|  |    196 |    !      not
 | 
|  |    197 |    && ||  and, or
 | 
|  |    198 | */
 | 
| 15 |    199 | 
 | 
|  |    200 | 
 | 
| 189 |    201 | def fact2(n: BigInt) : BigInt = 
 | 
| 14 |    202 |   if (n == 0) 1 else n * fact2(n - 1)
 | 
|  |    203 | 
 | 
| 25 |    204 | fact2(150)
 | 
|  |    205 | 
 | 
| 26 |    206 | 
 | 
| 189 |    207 | def fib(n: Int) : Int =
 | 
| 14 |    208 |   if (n == 0) 1 else
 | 
| 26 |    209 |     if (n == 1) 1 else fib(n - 1) + fib(n - 2)
 | 
| 14 |    210 | 
 | 
|  |    211 | 
 | 
| 26 |    212 | //gcd - Euclid's algorithm
 | 
|  |    213 | 
 | 
| 123 |    214 | def gcd(a: Int, b: Int) : Int =
 | 
| 26 |    215 |   if (b == 0) a else gcd(b, a % b)
 | 
|  |    216 | 
 | 
|  |    217 | gcd(48, 18)
 | 
|  |    218 | 
 | 
| 14 |    219 | 
 | 
| 123 |    220 | def power(x: Int, n: Int) : Int =
 | 
| 199 |    221 |   if (n == 0) 1 else x * power(x, n - 1) 
 | 
| 123 |    222 | 
 | 
|  |    223 | power(5, 5)
 | 
|  |    224 | 
 | 
|  |    225 | 
 | 
| 199 |    226 | // Option type
 | 
|  |    227 | //=============
 | 
|  |    228 | 
 | 
|  |    229 | //in Java if something unusually happens, you return null
 | 
|  |    230 | //
 | 
| 200 |    231 | //in Scala you use Options instead
 | 
| 199 |    232 | //   - if the value is present, you use Some(value)
 | 
|  |    233 | //   - if no value is present, you use None
 | 
|  |    234 | 
 | 
|  |    235 | 
 | 
|  |    236 | List(7,2,3,4,5,6).find(_ < 4)
 | 
|  |    237 | List(5,6,7,8,9).find(_ < 4)
 | 
|  |    238 | 
 | 
|  |    239 | 
 | 
|  |    240 | 
 | 
|  |    241 | // error handling with Options (no exceptions)
 | 
|  |    242 | //
 | 
|  |    243 | //  Try(something).getOrElse(what_to_do_in_case_of_an_exception)
 | 
|  |    244 | //
 | 
|  |    245 | import scala.util._
 | 
|  |    246 | import io.Source
 | 
|  |    247 | 
 | 
|  |    248 | val my_url = "https://nms.kcl.ac.uk/christian.urban/"
 | 
|  |    249 | 
 | 
|  |    250 | Source.fromURL(my_url).mkString
 | 
|  |    251 | 
 | 
|  |    252 | Try(Source.fromURL(my_url).mkString).getOrElse("")
 | 
|  |    253 | 
 | 
|  |    254 | Try(Some(Source.fromURL(my_url).mkString)).getOrElse(None)
 | 
|  |    255 | 
 | 
|  |    256 | 
 | 
|  |    257 | // the same for files
 | 
|  |    258 | Source.fromFile("test.txt").mkString
 | 
|  |    259 | 
 | 
| 200 |    260 | // function reading something from files...
 | 
|  |    261 | 
 | 
|  |    262 | def get_contents(name: String) : List[String] = 
 | 
|  |    263 |   Source.fromFile(name).getLines.toList
 | 
|  |    264 | 
 | 
|  |    265 | get_contents("test.txt")
 | 
|  |    266 | 
 | 
|  |    267 | // slightly better - return Nil
 | 
|  |    268 | def get_contents(name: String) : List[String] = 
 | 
|  |    269 |   Try(Source.fromFile(name).getLines.toList).getOrElse(Nil)
 | 
|  |    270 | 
 | 
|  |    271 | get_contents("text.txt")
 | 
|  |    272 | 
 | 
|  |    273 | // much better - you record in the type that things can go wrong 
 | 
|  |    274 | def get_contents(name: String) : Option[List[String]] = 
 | 
|  |    275 |   Try(Some(Source.fromFile(name).getLines.toList)).getOrElse(None)
 | 
|  |    276 | 
 | 
|  |    277 | get_contents("text.txt")
 | 
|  |    278 | 
 | 
|  |    279 | 
 | 
| 199 |    280 | 
 | 
| 25 |    281 | // String Interpolations
 | 
|  |    282 | //=======================
 | 
| 14 |    283 | 
 | 
| 26 |    284 | val n = 3
 | 
|  |    285 | println("The square of " + n + " is " + square(n) + ".")
 | 
|  |    286 | 
 | 
|  |    287 | println(s"The square of ${n} is ${square(n)}.")
 | 
|  |    288 | 
 | 
|  |    289 | 
 | 
| 200 |    290 | // helpful for debugging purposes
 | 
|  |    291 | //
 | 
|  |    292 | //         "The most effective debugging tool is still careful thought, 
 | 
|  |    293 | //          coupled with judiciously placed print statements."
 | 
|  |    294 | //                   — Brian W. Kernighan, in Unix for Beginners (1979)
 | 
|  |    295 | 
 | 
| 26 |    296 | 
 | 
| 123 |    297 | def gcd_db(a: Int, b: Int) : Int = {
 | 
| 26 |    298 |   println(s"Function called with ${a} and ${b}.")
 | 
|  |    299 |   if (b == 0) a else gcd_db(b, a % b)
 | 
|  |    300 | }
 | 
|  |    301 | 
 | 
|  |    302 | gcd_db(48, 18)
 | 
|  |    303 | 
 | 
| 14 |    304 | 
 | 
| 124 |    305 | // Asserts/Testing
 | 
| 200 |    306 | //=================
 | 
| 14 |    307 | 
 | 
| 32 |    308 | assert(gcd(48, 18) == 6)
 | 
|  |    309 | 
 | 
|  |    310 | assert(gcd(48, 18) == 5, "The gcd test failed")
 | 
|  |    311 | 
 | 
|  |    312 | 
 | 
| 26 |    313 | // For-Comprehensions (not For-Loops)
 | 
|  |    314 | //====================================
 | 
| 14 |    315 | 
 | 
|  |    316 | for (n <- (1 to 10).toList) yield square(n)
 | 
|  |    317 | 
 | 
| 25 |    318 | for (n <- (1 to 10).toList; 
 | 
|  |    319 |      m <- (1 to 10).toList) yield m * n
 | 
| 21 |    320 | 
 | 
|  |    321 | 
 | 
| 26 |    322 | val mult_table = 
 | 
|  |    323 |   for (n <- (1 to 10).toList; 
 | 
|  |    324 |        m <- (1 to 10).toList) yield m * n
 | 
|  |    325 | 
 | 
|  |    326 | mult_table.sliding(10,10).mkString("\n")
 | 
|  |    327 | 
 | 
| 200 |    328 | // the list/set/... can also be constructed in any 
 | 
|  |    329 | // other way
 | 
| 189 |    330 | for (n <- List(10,12,4,5,7,8,10)) yield n * n
 | 
|  |    331 | 
 | 
| 25 |    332 | 
 | 
| 200 |    333 | // with if-predicates / filters
 | 
| 32 |    334 | 
 | 
|  |    335 | for (n <- (1 to 3).toList; 
 | 
|  |    336 |      m <- (1 to 3).toList;
 | 
|  |    337 |      if (n + m) % 2 == 0) yield (n, m)
 | 
|  |    338 | 
 | 
| 148 |    339 | for (n <- (1 to 3).toList; 
 | 
|  |    340 |      m <- (1 to 3).toList;
 | 
|  |    341 |      if ((n + m) % 2 == 0)) yield (n, m)
 | 
| 32 |    342 | 
 | 
| 26 |    343 | // with patterns
 | 
|  |    344 | 
 | 
| 199 |    345 | val lst = List((1, 4), (2, 3), (3, 2), (4, 1))
 | 
| 26 |    346 | 
 | 
| 199 |    347 | for ((m, n) <- lst) yield m + n 
 | 
|  |    348 | 
 | 
|  |    349 | for (p <- lst) yield p._1 + p._2 
 | 
| 26 |    350 | 
 | 
| 25 |    351 | 
 | 
| 200 |    352 | // general pattern of for-yield
 | 
| 189 |    353 | 
 | 
| 200 |    354 | for (p <- ...) yield {
 | 
| 189 |    355 |   // potentially complicated
 | 
|  |    356 |   // calculation of a result
 | 
|  |    357 | }
 | 
|  |    358 | 
 | 
| 200 |    359 | // Functions producing multiple outputs
 | 
|  |    360 | //======================================
 | 
| 189 |    361 | 
 | 
| 200 |    362 | def get_ascii(c: Char) : (Char, Int) = (c, c.toInt)
 | 
|  |    363 | 
 | 
|  |    364 | get_ascii('a')
 | 
|  |    365 | 
 | 
|  |    366 | 
 | 
|  |    367 | // .maxBy, sortBy with pairs
 | 
|  |    368 | def get_length(s: String) : (String, Int) = (s, s.length) 
 | 
|  |    369 | 
 | 
|  |    370 | val lst = List("zero", "one", "two", "three", "four", "ten")
 | 
|  |    371 | val strs = for (s <- lst) yield get_length(s)
 | 
|  |    372 | 
 | 
|  |    373 | strs.sortBy(_._2)
 | 
|  |    374 | strs.sortBy(_._1)
 | 
|  |    375 | 
 | 
|  |    376 | strs.maxBy(_._2)
 | 
|  |    377 | strs.maxBy(_._1)
 | 
|  |    378 | 
 | 
|  |    379 | 
 | 
|  |    380 | // For without yield
 | 
|  |    381 | //===================
 | 
| 25 |    382 | 
 | 
| 36 |    383 | // with only a side-effect (no list is produced),
 | 
| 32 |    384 | // has no "yield"
 | 
|  |    385 | 
 | 
|  |    386 | for (n <- (1 to 10)) println(n)
 | 
|  |    387 | 
 | 
|  |    388 | 
 | 
| 199 |    389 | // BTW: a roundabout way of printing out a list, say
 | 
|  |    390 | val lst = ('a' to 'm').toList
 | 
| 140 |    391 | 
 | 
| 199 |    392 | for (i <- (0 until lst.length)) println(lst(i))
 | 
|  |    393 | 
 | 
| 200 |    394 | // Why not just? Why making your life so complicated?
 | 
| 199 |    395 | for (c <- lst) println(c)
 | 
|  |    396 | 
 | 
|  |    397 | // Aside: concurrency 
 | 
|  |    398 | // (ONLY WORKS OUT-OF-THE-BOX IN SCALA 2.11.8, not in SCALA 2.12)
 | 
|  |    399 | // (would need to have this wrapped into a function, or
 | 
|  |    400 | //  REPL called with scala -Yrepl-class-based)
 | 
| 32 |    401 | for (n <- (1 to 10)) println(n)
 | 
|  |    402 | for (n <- (1 to 10).par) println(n)
 | 
|  |    403 | 
 | 
|  |    404 | 
 | 
| 36 |    405 | // for measuring time
 | 
| 140 |    406 | def time_needed[T](n: Int, code: => T) = {
 | 
| 32 |    407 |   val start = System.nanoTime()
 | 
| 140 |    408 |   for (i <- (0 to n)) code
 | 
| 32 |    409 |   val end = System.nanoTime()
 | 
| 140 |    410 |   (end - start) / 1.0e9
 | 
| 32 |    411 | }
 | 
|  |    412 | 
 | 
| 140 |    413 | 
 | 
| 32 |    414 | val list = (1 to 1000000).toList
 | 
|  |    415 | time_needed(10, for (n <- list) yield n + 42)
 | 
|  |    416 | time_needed(10, for (n <- list.par) yield n + 42)
 | 
|  |    417 | 
 | 
|  |    418 | 
 | 
| 140 |    419 | 
 | 
| 200 |    420 | // Just for "Fun": Mutable vs Immutable
 | 
|  |    421 | //=======================================
 | 
|  |    422 | //
 | 
|  |    423 | // - no vars, no ++i, no +=
 | 
|  |    424 | // - no mutable data-structures (no Arrays, no ListBuffers)
 | 
| 137 |    425 | 
 | 
| 32 |    426 | 
 | 
| 200 |    427 | // Q: Count how many elements are in the intersections of two sets?
 | 
|  |    428 | 
 | 
|  |    429 | def count_intersection(A: Set[Int], B: Set[Int]) : Int = {
 | 
|  |    430 |   var count = 0
 | 
|  |    431 |   for (x <- A; if (B contains x)) count += 1 
 | 
|  |    432 |   count
 | 
|  |    433 | }
 | 
| 32 |    434 | 
 | 
| 200 |    435 | val A = (1 to 1000).toSet
 | 
|  |    436 | val B = (1 to 1000 by 4).toSet
 | 
|  |    437 | 
 | 
|  |    438 | count_intersection(A, B)
 | 
|  |    439 | 
 | 
|  |    440 | // but do not try to add .par to the for-loop above
 | 
|  |    441 | 
 | 
| 32 |    442 | 
 | 
| 200 |    443 | //propper parallel version
 | 
|  |    444 | def count_intersection2(A: Set[Int], B: Set[Int]) : Int = 
 | 
|  |    445 |   A.par.count(x => B contains x)
 | 
|  |    446 | 
 | 
|  |    447 | count_intersection2(A, B)
 | 
|  |    448 | 
 | 
| 32 |    449 | 
 | 
| 200 |    450 | //for measuring time
 | 
|  |    451 | def time_needed[T](n: Int, code: => T) = {
 | 
|  |    452 |   val start = System.nanoTime()
 | 
|  |    453 |   for (i <- (0 to n)) code
 | 
|  |    454 |   val end = System.nanoTime()
 | 
|  |    455 |   (end - start) / 1.0e9
 | 
|  |    456 | }
 | 
|  |    457 | 
 | 
|  |    458 | val A = (1 to 1000000).toSet
 | 
|  |    459 | val B = (1 to 1000000 by 4).toSet
 | 
|  |    460 | 
 | 
|  |    461 | time_needed(10, count_intersection(A, B))
 | 
|  |    462 | time_needed(10, count_intersection2(A, B))
 | 
|  |    463 | 
 | 
| 32 |    464 | 
 | 
|  |    465 | // Further Information
 | 
|  |    466 | //=====================
 | 
|  |    467 | 
 | 
| 200 |    468 | // The Scala homepage and general information is at
 | 
| 32 |    469 | //
 | 
|  |    470 | //  http://www.scala-lang.org
 | 
| 123 |    471 | //	http://docs.scala-lang.org
 | 
|  |    472 | //
 | 
|  |    473 | //
 | 
|  |    474 | // It should be fairly easy to install the Scala binary and
 | 
| 200 |    475 | // run Scala on the commandline. People also use Scala with 
 | 
|  |    476 | // Vim and Jedit. I currently settled on VS Code
 | 
| 123 |    477 | //
 | 
| 200 |    478 | //   https://code.visualstudio.com
 | 
| 123 |    479 | //
 | 
| 200 |    480 | // There are also plugins for Eclipse and IntelliJ - YMMV.
 | 
|  |    481 | // Finally there are online editors specifically designed for 
 | 
|  |    482 | // running Scala applications (but do not blame me if you lose 
 | 
|  |    483 | // all what you typed in):
 | 
| 123 |    484 | //
 | 
| 200 |    485 | //   https://scalafiddle.io 
 | 
|  |    486 | //   https://scastie.scala-lang.org
 | 
| 124 |    487 | //
 | 
| 123 |    488 | //
 | 
|  |    489 | //
 | 
|  |    490 | // Scala Library Docs
 | 
| 124 |    491 | //====================
 | 
| 123 |    492 | //
 | 
|  |    493 | //  http://www.scala-lang.org/api/current/
 | 
|  |    494 | //
 | 
|  |    495 | // Scala Tutorials
 | 
|  |    496 | //
 | 
|  |    497 | //  http://docs.scala-lang.org/tutorials/
 | 
|  |    498 | //
 | 
|  |    499 | // There are also a massive number of Scala tutorials on youtube
 | 
| 200 |    500 | // and there are tons of books and free material. Google is your 
 | 
|  |    501 | // friend.
 | 
| 32 |    502 | 
 | 
|  |    503 | 
 | 
| 170 |    504 | 
 | 
|  |    505 | 
 | 
|  |    506 | 
 | 
|  |    507 | 
 | 
|  |    508 | 
 | 
|  |    509 | 
 | 
|  |    510 | 
 | 
| 195 |    511 | 
 | 
|  |    512 | 
 | 
|  |    513 | 
 | 
|  |    514 | 
 | 
|  |    515 | 
 | 
|  |    516 | 
 |