Skip to content

Commit

Permalink
Use Z for count
Browse files Browse the repository at this point in the history
  • Loading branch information
drewolson committed Dec 9, 2023
1 parent ee7616b commit 6f82988
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions lib/year2023/day08.ml
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,12 @@ let solve' { dirs; map } =
| L -> l
| R -> r)
in
if List.is_empty nodes' then Error steps' else Ok (count + 1, steps', nodes')
if List.is_empty nodes' then Error steps' else Ok (Z.add count Z.one, steps', nodes')
in
dirs
|> Sequence.fold_result ~init:(0, [], starts) ~f:make_move
|> Sequence.fold_result ~init:(Z.zero, [], starts) ~f:make_move
|> Result.error
|> Option.value_exn
|> List.map ~f:Z.of_int
|> List.fold ~init:Z.one ~f:Z.lcm
|> Z.to_string
;;
Expand Down

0 comments on commit 6f82988

Please sign in to comment.