This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
internal extension SequenceType where Element: Hashable { | |
/** | |
Returns a modified djb hash of all of the elements in a list. | |
Reference: http://www.eternallyconfuzzled.com/tuts/algorithms/jsw_tut_hashing.aspx | |
*/ | |
internal var hashValue: Int { | |
get { | |
return reduce(0) { (x, element) -> Int in | |
return 33 * x ^ element.hashValue | |
} |
NewerOlder