0

Say I have a list of items with prices like this:

[{:dog=>3.0}, {:cat=>5.0},{:dog=>3.0}]

how could i collate the dog hashes as they are the same, and maybe produce something like this:

[{:dog=>6.0},{:cat=>5.0}]

or (it may be clearer to have something like this):

[{tally=>2, :dog=>3.0}, {tally=>1, :cat=>5.0}]
Bandook
  • 658
  • 6
  • 21
Dillon Barker
  • 70
  • 1
  • 6

0 Answers0