Skip to content

Instantly share code, notes, and snippets.

@izmailoff
Created February 4, 2016 09:43
Show Gist options
  • Save izmailoff/7ee252f81136052adeea to your computer and use it in GitHub Desktop.
Save izmailoff/7ee252f81136052adeea to your computer and use it in GitHub Desktop.
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