Hacker News new | ask | show | jobs
by timrod 5431 days ago
I'd write the scala example as

  names zip ages foreach { (name, age) =>
    println(name + ": " + age)
  }
which, imho, is a little easier on the eyes.

[edit: fix syntax]

1 comments

How does Scala figure out the precedence on that? And in general what does `word1 word2 ... wordN` mean?
It goes something like:

  a b c d e f g
becomes:

  a.b(c).d(e).f(g)
I've never tried Scala so I'm speaking from ignorance here, but that looks awfully hard to parse for a human reader. I much prefer Haskell's:

     zipWith (\x y->  x ++ " : " ++ show y) names ages