Live data from Hacker News

Scala 2.9.0 final

scala-lang.org

1–10 of 17 posts

Re: Scala 2.9.0 final

#7

Says our lead programmer: "The new parallel collections are amazing!"

This to me is amazing in it's brevity:

  //Uses 4 threads
  (1 to 4).par.foreach(x => /*some long computation*/ }
I'd love to see how other languages can do it more tersely with their standard libraries.

Re: Scala 2.9.0 final

#8
post #7

Says our lead programmer: "The new parallel collections are amazing!"

This to me is amazing in it's brevity: //Uses 4 threads (1 to 4).par.foreach(x => /*some long computation*/ } I'd love to see how other languages can do it more tersely with their standard libraries.

In haskell you could write something like this: parMap rseq (\x->/some long computation/) [1..4]

using the standard Control.Parallel.Strategies library (use rwhnf instead of rseq unless you are using v3).

Re: Scala 2.9.0 final

#9
post #7

Says our lead programmer: "The new parallel collections are amazing!"

This to me is amazing in it's brevity: //Uses 4 threads (1 to 4).par.foreach(x => /*some long computation*/ } I'd love to see how other languages can do it more tersely with their standard libraries.

In python:

  from multiprocessing import Pool
  p = Pool(4) # 4 worker threads
  p.map(somefunc, someiter)
Not sure if this is apples-to-apples. Regardless, I'm always skeptical of the behavior of threaded code, even if it's embarrassingly parallel stuff that is divided among workers.
Post reply on HN