fancyFuncdoFancyStuff
package main
import "fmt"
type fancyFunc func(a,b,c int) int
func doFancyStuff(f FancyFunc) int {
// Do something special with f
return 42
}
func main() {
// This works but is rather tedious:
f1 := func(a,b,c int) int { return a + b + c }
// I would like to create them like this:
f2 := fancyFunc{ return a * b * c }
// Eventually, they are used like this:
fmt.Println(doFancyStuff(f1))
fmt.Println(doFancyStuff(f2))
}