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

that, or even 10 lines, is still several orders of magnitude more code than how you do it in a dynamic language like ruby or python


It's not really dynamism so much as a functional outlook. Here it is in Scala (probably with a healthy number of syntax errors, and certainly with a whiff of inexperience):

  def studentsWhoHaveNotTakenAtLeastOneTest = getStudents.filter{s => s.getTests.filter{t => !t.isTaken}.size > 0}.sorted
You could get a similar amount of code in Java using something like FunctionalJava but that's not really a fair comparison, because patio11 is illustrating Java as it's spotted in the wild, and thus so am I. But with appropriate libraries and implementation patterns you can certainly write concise Java if you so choose.




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

Search: