Skip to content

Commit

Permalink
Fix execution order of map_string_matches
Browse files Browse the repository at this point in the history
Co-authored-by: Gaëtan Gilbert <[email protected]>
  • Loading branch information
JasonGross and SkySkimmer committed Jan 24, 2023
1 parent a3b57d4 commit 8d81a74
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/helpers.ml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ let rec fold_string_matches ~regexp ~f ~init ?(pos = 0) string =
else init

let map_string_matches ~regexp ~f string =
fold_string_matches ~regexp ~f:(fun rest -> f () :: rest ()) ~init:[] string
fold_string_matches ~regexp ~f:(fun rest -> let v = f () in v :: rest ()) ~init:[] string

let iter_string_matches ~regexp ~f string =
fold_string_matches ~regexp ~f:(fun rest -> f () ; rest ()) ~init:() string
Expand Down

0 comments on commit 8d81a74

Please sign in to comment.