func block(records []Record) map[string][]Record { blocks := map[string][]Record{} for _, record := range records { blocks[record.City] = append(blocks[record.City], record) } return blocks } func main() { records := loadRecords(100) blocks := block(records) comparisons := 0 matchCount := 0 for _, blockRecords := range blocks { c, m := compare(blockRecords) comparisons += c matchCount += m } fmt.Printf("made %d comparisons and found %d matches\n", comparisons, matchCount) }