Skip to content

Instantly share code, notes, and snippets.

@nathankrishnan
Created April 9, 2017 18:11
Show Gist options
  • Save nathankrishnan/a12b1069afb62f509488c454c16f4213 to your computer and use it in GitHub Desktop.
Save nathankrishnan/a12b1069afb62f509488c454c16f4213 to your computer and use it in GitHub Desktop.
public func query(_ value: T) -> Bool {
let hashValuePositions = computeHashes(value)
let valuesAtIndices = hashValuePositions.map() { hashValuePosition in array[hashValuePosition] }
let exists = valuesAtIndices.reduce(true, { $0 && $1 })
return exists
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment