Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In similar code, I've done something like the following because I wanted the hash keys to be factored into the hash:
I like your solution though because the work to create the Array has already been done anyway. Might as well call
Array#hash
rather than usingEnumerable#reduce
to xor the hashes.. it's simpler and probably optimized.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if you want your keys counted in #hash, you should probably just use
Hash#hash. It's uniform and calls #hash on all the keys and values
recursively.
using just xor is bad for uniformity. Though, that matters only if you use
your objects as Hash keys or in sets or if you do .uniq on them. You don't
want 1000's of your objects in one bucket.
On Thu, Dec 19, 2013 at 10:34 AM, Dan Kubb notifications@github.com wrote: