Volker thanks for the reply. Coming from Python I can do a simple test like
if item in my_array:
# do something
else:
# do something else
I can understand that it cannot be that easy in Go (and then, why not,
"equals" is already defined), but image you
have to use a for-loop every time or a specialized function every time.
That is awkward and unnecessary.
I agree, that the more complex idea to have a "findFirst" with a dedicated
matching function
is more complicated, but hey, sort.Slice is the same thing, isn't it? It
takes a comparison func to return -1, 0, or 1.
func findFirst(slice interface{}, matches func(i int
<https://golang.org/pkg/builtin/#int>) int)
Just my 0.02.
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.