Created
February 4, 2016 09:43
-
-
Save izmailoff/7ee252f81136052adeea to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import scala.concurrent._ | |
import scala.concurrent.ExecutionContext.Implicits.global | |
import scala.concurrent.duration._ | |
def someFunction(a: Int, b: Int): Future[Int] = Future(a * b) | |
val args = Map( | |
(true, true) -> List((0,0), (0,1), (1,0), (1,1)), | |
(true, false) -> List((0,0), (1,0)), | |
(false, true) -> List((0,0), (0,1)), | |
(false, false) -> List((0,0))) | |
val value1 = true | |
val value2 = false | |
val fsum = Future.traverse(args(value1, value2))((someFunction _) tupled) map(_.sum) | |
val res = Await.result(res8, 5 seconds) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment