Hacker News new | ask | show | jobs
by setpatchaddress 1652 days ago
Note how much more concise and yet readable the equivalent Ruby is.
1 comments

If you want to play code golf you can do static imports and write this:

    int numberOfAuthors = arr.stream().map(getAuthor).distinct().collect(counting());
You still save a few parentheses and one method call in Ruby (.compact vs .stream() and .collect()) and the method names are shorter. Mostly it's a matter of static vs dynamic typing and naming conventions, not a consequence of Ruby code blocks. And is it worth shortening at this point?

BTW I know uniq is a thing in unix, but I hate this naming decision.