Skip to content

Instantly share code, notes, and snippets.

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
}