Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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]



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




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: