From d3bd49511fe2003f5b0916d9a74152d6fa1b7e2d Mon Sep 17 00:00:00 2001 From: drew Date: Fri, 8 Dec 2023 11:29:28 +0800 Subject: [PATCH] No ppx let for lists --- lib/year2023/day07.ml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/year2023/day07.ml b/lib/year2023/day07.ml index 7421df8..03aa475 100644 --- a/lib/year2023/day07.ml +++ b/lib/year2023/day07.ml @@ -86,12 +86,10 @@ let hand_type hand = let rec expand = function | [] -> [ [] ] | Jack :: rest -> - let%bind.List c = all_of_card - and h = expand rest in - if equal_card c Jack then [] else [ c :: h ] - | c :: rest -> - let%map.List hand = expand rest in - c :: hand + List.concat_map all_of_card ~f:(function + | Jack -> [] + | c -> List.map (expand rest) ~f:(List.cons c)) + | c :: rest -> List.map (expand rest) ~f:(List.cons c) ;; let hand_type' hand =