package main func countRF(n int) func(yield func(int) bool) { return func(yield func(int) bool) { for i := range n { if !yield(i) { return } } } }