Skip to content

Instantly share code, notes, and snippets.

@nakajima
Forked from jm/gist:84447
Created March 25, 2009 00:47
Show Gist options
  • Save nakajima/84466 to your computer and use it in GitHub Desktop.
Save nakajima/84466 to your computer and use it in GitHub Desktop.
# not to be a dick, just for fun
res = %w(one two three one two one).inject(Hash.new(0)) do |counts, t|
counts[t] += 1
counts
end
p res
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment