Created
March 27, 2022 18:54
-
-
Save fogfish/5fd9d9fba6f3f4a400b7c7b22a26757c to your computer and use it in GitHub Desktop.
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
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