Skip to content

Commit

Permalink
Clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
drewolson committed Dec 11, 2023
1 parent a94daa8 commit b63565c
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions lib/year2023/day10.ml
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,8 @@ let find_start grid =
|> Option.value_exn
;;

let neighbor_coords (x, y) = [ x + 1, y; x - 1, y; x, y + 1; x, y - 1 ]

let neighbors grid coord =
coord
|> neighbor_coords
|> List.zip_exn [ E; W; S; N ]
let neighbors grid (x, y) =
[ E, (x + 1, y); W, (x - 1, y); S, (x, y + 1); N, (x, y - 1) ]
|> List.filter_map ~f:(fun (d, c) -> Map.find grid c |> Option.map ~f:(fun v -> d, v))
;;

Expand Down

0 comments on commit b63565c

Please sign in to comment.