Skip to content

Instantly share code, notes, and snippets.

@michaeleisel
Created March 27, 2019 19:06
Show Gist options
  • Save michaeleisel/e1a6efc17cc3d3d54d1318fa75e2ddc7 to your computer and use it in GitHub Desktop.
Save michaeleisel/e1a6efc17cc3d3d54d1318fa75e2ddc7 to your computer and use it in GitHub Desktop.
func f() {
let max = range.product(range).maxWith { (topRow, leftCol) -> (Int) in
return (0..<3).product(0..<3).map { rowOffset, colOffset in // (rowOffset: Int, colOffset: Int) -> (Int) in
return scores[topRow + rowOffset][leftCol + colOffset]
}.reduce(0, +)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment