|
|
|
|
|
by Tarean
3425 days 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
|
|