Skip to content

Instantly share code, notes, and snippets.

@fogfish
Created March 27, 2022 18:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fogfish/5fd9d9fba6f3f4a400b7c7b22a26757c to your computer and use it in GitHub Desktop.
Save fogfish/5fd9d9fba6f3f4a400b7c7b22a26757c to your computer and use it in GitHub Desktop.
type Haystack[T any] struct{ Eq[T] }
func (h Haystack[T]) Lookup(a T, b []T) bool {
for _, x := range b {
if h.Eq.Equal(a, x) {
return true
}
}
return false
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment