Monday, 24 October 2016

Why Scala ?

As in my daily job all of my colleague ask me why scala ? 

Every time me telling them few things about scala, which I remember at that time, so finally I'm collecting  reason why scala ?
I will go adding into list, as I get know more Why Scala.

  • Mix of Functional and OO Programming
  • Strongly typed 
  • Strong Integration with Java
  • JVM Language
  • Rich collection API
  • Awesome syntax
  • REPL (Experient Orient Development)
    • Read 
    • Eval
    • Print
    • Loop  

Sunday, 2 October 2016

Beauty of Scala (QuickSort in two line) that is just Awesome


package programming

object QuickSort extends App {

  quickSort(Array(8, 5, 6, 9, 1, 7, 2)).foreach(println)

  def quickSort(a:Array[Int]):Array[Int] =
    if(a.length < 2)  a else
    (quickSort(a.filter(_< a(a.length-1))) :+ a(a.length-1)) ++ quickSort(a.filter(_> a(a.length-1)))
 
}