blob: 905d3606120309b6c09ccd74730f29a62d7d3032 (
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]): Unit = {
val x = future(someLengthyComputation);
anotherLengthyComputation;
val y = f(x()) + g(x());
Console.println(y)
}
}
|