def slowAsyncFunc(param: String): Future[Int] = ...val params: Seq[String] = ...val results: Future[Seq[Int]] = Future.traverse(param)(slowAsyncFunc)
--
You received this message because you are subscribed to the Google Groups "scala-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-user+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Hello,
I think you want to use fold methods.
Best, Oliver
--
--
val params1: Seq[String] = ...val params2: Seq[String] = ...def findCandidate(p1: String, p2: String): Future[Maneuver] = ...val candidates: Future[Seq[Maneuver]] = Future.sequence{for {p1 <- params1p2 <- params2} yield findCandidate(p1,p2)}val successfulCandidates: Future[Seq[Maneuver]] = candidates map { _.filter(_.successful) }
--
On Thu, Oct 1, 2015, 12:11 AM Russ P. <russ.p...@gmail.com> wrote:
Thanks for the explanation, but I'm not sure I understand what you are saying. Let's take your second example:
for {
a <- aa
b <- bb
c <- cc
} yield (a, b, c)
Are you saying that I can't parallelize this as follows:
for {
a <- aa.par
b <- bb.par
c <- cc.par
} yield (a, b, c)
If I can't do that, can I do something like this:
val tups = for {
a <- aa
b <- bb
c <- cc
} yield (a, b, c)
I think you can do (aa, bb, cc).zipped
To unsubscribe from this group and stop receiving emails from it, send an email to scala-user+unsub...@googlegroups.com.