Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

s14616 kolokwium

object HelloWorld {
   def main(args: Array[String]) {
      def pow[T](l: Vector[T], w: T => Boolean): Vector[T] = l.reverse.filterNot(w)
      val z1 = pow[Int](Vector(0, 1, 1, 2), num => {if(num%2 != 0) true else false})
      z1.foreach(println)
      println
      val z2 = pow[Char](Vector('a','b','c','d'), let => {if(let=='b')true else false})
      z2.foreach(println)}
      
      def frq(l: String) : Map[Char, Int] = {
        l.groupBy(identity).mapValues(_.size)
      }
      println(frq("Abba"))
} 

Advertisements
Loading...

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.