Skip to content

Commit e2bf53a

Browse files
committed
Renames
1 parent 0c7621f commit e2bf53a

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

src/common/Unicode.ml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ let is_ascii s =
1313

1414
let normalize = Uunf_string.normalize_utf_8 `NFKC
1515

16-
let fold_uchars f acc str =
16+
let foldi_uchars ~f acc str =
1717
let len = String.length str in
1818
let rec loop pos acc =
1919
if pos == len then acc
@@ -25,19 +25,19 @@ let fold_uchars f acc str =
2525
loop (pos + char_length) acc in
2626
loop 0 acc
2727

28-
let iter_uchars s f =
28+
let iteri_uchars ~f str =
2929
let f' buf pos c =
3030
f pos c;
3131
Buffer.add_utf_8_uchar buf c;
3232
buf in
3333
let s_after =
34-
Buffer.contents @@ fold_uchars f' (Buffer.create (String.length s)) s in
34+
Buffer.contents @@ foldi_uchars ~f:f' (Buffer.create (String.length str)) str in
3535
(* another sanity check *)
36-
if not (String.equal s s_after) then
36+
if not (String.equal str s_after) then
3737
Core.(
3838
ICE.internal_compiler_error
3939
[%message
40-
"Failed to round-trip unicode string!" (s : string) (s_after : string)])
40+
"Failed to round-trip unicode string!" (str : string) (s_after : string)])
4141

4242
(* WIP:
4343
@@ -60,7 +60,7 @@ let confusable x y =
6060
(* TODO!! replace with prototype - need data? *)
6161
Buffer.add_utf_8_uchar acc c;
6262
acc in
63-
let buf = fold_uchars f (Buffer.create (String.length x)) x in
63+
let buf = foldi_uchars ~f (Buffer.create (String.length x)) x in
6464
let x = Buffer.contents buf in
6565
let x = Uunf_string.normalize_utf_8 `NFD x in
6666
x in
@@ -98,7 +98,7 @@ let restriction_level x =
9898
let scripts =
9999
Uucp.Script.script_extensions c |> ScriptSet.of_list |> extended in
100100
scripts :: acc in
101-
let soss = fold_uchars f [] x in
101+
let soss = foldi_uchars ~f [] x in
102102
let resolved = List.fold_right ScriptSet.inter soss all in
103103
if not @@ ScriptSet.is_empty resolved then `Single
104104
else `Unrestricted (* TODO implement levels 3-5 *)

src/frontend/Identifiers.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ let validate_utf8_id ~loc id =
3838
error ~loc
3939
(Fmt.str "Invalid character in identifier at offset %d: '%a'" pos
4040
pp_uchar uchar) in
41-
iter_uchars id f;
41+
iteri_uchars ~f id;
4242
id
4343

4444
let validate loc id =

src/stan_math_backend/Cpp.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ module Printing = struct
399399
let uchar_int = Uchar.to_scalar c in
400400
if uchar_int < 128 then Fmt.char ppf (Char.of_int_exn uchar_int)
401401
else Fmt.pf ppf "\\u%04X" (Uchar.to_scalar c) in
402-
Common.Unicode.iter_uchars s f
402+
Common.Unicode.iteri_uchars ~f s
403403

404404
let rec pp_type_ ppf t =
405405
match t with

0 commit comments

Comments
 (0)