Higher order functions implemented in Go