Re:The Yoda of Silicon Valley
by sobellian on Monday December 17, 2018 @04:45PM
(#18702507)
Well, what is easy or comprehensible isn't necessarily concise. Bash is great for code golf but I know few people who prefer to code in it.
[ Parent
| on HN ]
And for completeness, a Ruby implementation:
puts STDIN.read
.split(/[^A-Za-z]+/)
.group_by(&:downcase).transform_values(&:size)
.sort_by(&:last).reverse
.take(ARGV[0].to_i)
.map{ |l| l.join("\t") }.join("\n")
Wordier than the bash script, but still pretty short and fairly trivial. Anyone could make this in five minutes.