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

I think java's problem here is how annoying it is to split these up. For example your example completely split up in java vs haskell:

Java

  IntPredicate even = i -> i % 2 == 0;
  IntUnaryOperator add2 = i -> i + 2;
  UnaryOperator<IntStream> process = s -> s.filter(even).map(add2);
  for (int i in process.apply(numbers)) {
      System.out.println(String.valueOf(i));
  }
Haskell:

  printProcessed  = mapM_ print . process
    where process = map (+2) . filter even


It's even more concise in APL, assuming you know how to read APL.




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

Search: