3 ms·
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
by Tarean 10y ago
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
- pekk 10y agoIt's even more concise in APL, assuming you know how to read APL.