Skip to content

Commit

Permalink
Use find_map
Browse files Browse the repository at this point in the history
  • Loading branch information
drewolson committed Dec 13, 2023
1 parent 7fb13c2 commit 76fa1ae
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions lib/year2023/day13.ml
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,8 @@ let reflection_score' g =
with_swap coord ~f:(fun _ ->
g
|> reflection_score
|> List.filter_map ~f:(fun (axis, score) ->
if equal_axis axis old_axis then None else Some score)
|> List.hd))
|> List.find_map ~f:(fun (axis, score) ->
if equal_axis axis old_axis then None else Some score)))
|> Option.value_exn
;;

Expand Down

0 comments on commit 76fa1ae

Please sign in to comment.