How can I get a built-in operator as a function? I want to take advantage of functional programming. I have some files with vectorizing functions (eg. Remap[inT any](sl []inT, f func(inT) inT)), which take a scalar function to apply on every element of one or two slices.
func eq(a, b int)bool{
return a==b
}
and hope that after inlining there'll be no overhead.
But I prefer a short, performant & consistent way, if exists.
int.__eq__
i32::eq
#include <functional>
/*code here*/
std::equal_to<int>()
How can I get built-in operator as a function? Any
functional
package in Go?
You cannot.