Sources:http://www.scala-lang.org/
Installation:
download desired stable release from here.
extract : tar -xzf scala-x.y.z.tgz
put scala on path.(java must be there on path too).
test: scala -version
-------------
##Data types (Sources:docs.scala-lang.org):
##Constants & Variable:
##Functions:
##Iterative statements:
scala>val a = List(1,2,4,5)
a: List[Int] = List(1, 2, 4, 5)
scala> a.foreach(println(_))
##Conditional statements:
##Resource access[File reading, database, web...]:
//Excercise using ArrayBuffer
//Import ArrayBuffer
Import scala.collections.mutable.ArrayBuffer;
//Define an empty ArrayBuffer ar of type Int
//Add 10 into ar
//Add(20,30,40,50)
//insert 45 between 40 & 50
//create an array arr(1,2,3,4,5,10)
//append arr to ar
//Remove last 2 items in ar
// check if ar contains 45, 99
//reduce ar to its sum
// max, min and average of ar
//get first 5 elements of ar
//get all elems >30
// add 25 to all items in ar
//add 50 to items <30 else add 100
//sort ar
Use Map to find word count from string.