Education

#!/bin/bash
scala $0 $@
exit
!#

/*
 There are many ways to create and use function-like values
 in Scala.
 */


// Implicit function:
def id(x : Int) : Int = x

// Anonymous function:
val anonId = (x : Int) => x

// object with apply method:
object Id {
  def apply(x : Int) = x
}

// f(x) => f.apply(x)

© AthenaWare, LLC 2011