blob: e05b6b330e990181a6102e868ca0ecad8d5a1ac5 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
package examples
import concurrent.ops._
object futures {
def someLengthyComputation = 1
def anotherLengthyComputation = 2
def f(x: Int) = x + x
def g(x: Int) = x * x
def main(args: Array[String]) {
val x = future(someLengthyComputation)
anotherLengthyComputation
val y = f(x()) + g(x())
println(y)
}
}
|