Is it possible to use an operator in place of a function in go?
For example, in the following code is it possible to replace add
with +
?
package main
import "fmt"
var cur, prev int = 1, 1
func fib(f func(int, int) int) int {
return f(cur, prev)
}
func main() {
add := func(x int, y int) int { return x + y };
fmt.Println(fib(add))
}
If it's not possible to use operators as functions, then I would appreciate a link to the documentation clarifying this.