I have a function that accepts a function as a parameter:
func send(n int, c func(x int) int) int {
return c(n)
}
and I have a structure with a method defined on it
type data struct {
value int
}
func (t *data) set(x int) {
t.value = x
}
I would like to create an instance of the structure and pass method set
bound to this instance to the send
function as the second parameter, to set the value
field from send
.
Is this possible?