Senin, 10 Januari 2011

Abbreviated form of function Scala

$ cat Abbreviation.scala
val list = List(3,5,60,12,-9,53)

println (list)

println( list.filter( (x: Int) => x%3 == 0 ) )
println( list.filter( (x) => x%3 == 0 ) )
println( list.filter( x => x%3 == 0 ) )


$ scala Abbreviation.scala
List(3, 5, 60, 12, -9, 53)
List(3, 60, 12, -9)
List(3, 60, 12, -9)
List(3, 60, 12, -9)

Tidak ada komentar:

Poskan Komentar