True... although that is to me even less readable than the first Java version. The clojure version still wins by a large distance in my book because of its elegance.
That's not bad, but in the clojure version, I have to know/learn three functions: filter, even? and range
In the Java version, I need to know/learn IntStream.range, IntStream.filter, IntStream.collect, the even lambda, and Collectors.toList
Of course, this is comparing one-liners, so doesn't necessarily translate to larger programs. Just pointing out that I don't find this one particular example to be in Javas favour.
> IntStream.range(0, 100).filter(i -> i % 2 == 0).collect(Collectors.toList());
This has been added to java to catchup with functional programming languages.
I know those are functional concepts, but it feels more like trying to catch up with C# (LINQ) to me.
That's better, but Clojure still has less noise, and in my experience that adds up significantly in the long run.
Less noise, true. But the grand-grand-parents' point is that some of that noise provides context, which (arguably) improves readability.
IntStream.range(0, 100).filter(i -> i % 2 == 0).collect(Collectors.toList());
Disclaimer: I'm not writing Java nowadays, so this is my quick prototype from a quick google-session, it probably won't compile :D
Edit: looks like I'm second, my google-session took too long :-)
Maybe bonus points for C#: Enumerable.Range(0, 100).Where(i => i % 2 == 0);