Skip to content

Commit

Permalink
credit diagonals
Browse files Browse the repository at this point in the history
  • Loading branch information
mdr committed Dec 4, 2024
1 parent c4953da commit 9032c29
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions Aoc2024/Day04/Solve.lean
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ private def gridToString (g : Grid) : String := g.map List.asString |> String.in

private def flipHorizontal (grid : Grid) : Grid := grid.map (·.reverse)

-- ported from https://hackage.haskell.org/package/universe-base-1.1.4/docs/src/Data.Universe.Helpers.html#diagonals
private def diagonals (grid : List (List α)) : List (List α) :=
let rec go (b : List (List α)) (es : List (List α)) : List (List α) :=
let diagonal := b.filterMap List.head?
Expand Down

0 comments on commit 9032c29

Please sign in to comment.