is there simple way to do that?

this code slower
```ruby
h = {}
self.each do |e|
  v = yield(e)
  a = h[v] ||= []
  a << e
end
```