add Array#frequency for convenience
problem 54 in Ruby