From bdec3a28f6df1b3125e657acbf05d71df508a209 Mon Sep 17 00:00:00 2001
From: Allan Blanchard <allan.blanchard@cea.fr>
Date: Mon, 12 Sep 2022 17:06:17 +0200
Subject: [PATCH] [Extlib] removed iteri (List.iteri)

---
 bin/migration_scripts/manganese2iron.sh       | 3 ++-
 src/libraries/stdlib/extlib.ml                | 2 --
 src/libraries/stdlib/extlib.mli               | 5 -----
 src/plugins/metrics/gui/metrics_gui_panels.ml | 4 ++--
 4 files changed, 4 insertions(+), 10 deletions(-)

diff --git a/bin/migration_scripts/manganese2iron.sh b/bin/migration_scripts/manganese2iron.sh
index 9af1cd289a6..57295f6c7f7 100755
--- a/bin/migration_scripts/manganese2iron.sh
+++ b/bin/migration_scripts/manganese2iron.sh
@@ -87,7 +87,8 @@ process_file ()
   sedi "$file" \
    -e 's/Extlib\.id/Fun.id/g' \
    -e 's/Extlib\.swap/Fun.flip/g' \
-   -e 's/Extlib\.xor/(<>)/g'
+   -e 's/Extlib\.xor/(<>)/g' \
+   -e 's/Extlib\.iteri/List.iteri/g'
    # this line left empty on purpose
 }
 
diff --git a/src/libraries/stdlib/extlib.ml b/src/libraries/stdlib/extlib.ml
index 1aaa77b0c04..14d3703b43b 100644
--- a/src/libraries/stdlib/extlib.ml
+++ b/src/libraries/stdlib/extlib.ml
@@ -165,8 +165,6 @@ let opt_of_list =
   | [a] -> Some a
   | _ -> raise (Invalid_argument "Extlib.opt_of_list")
 
-let iteri f l = let i = ref 0 in List.iter (fun x -> f !i x; incr i) l
-
 let mapi f l =
   let res =
     snd (List.fold_left (fun (i,acc) x -> (i+1,f i x :: acc)) (0,[]) l)
diff --git a/src/libraries/stdlib/extlib.mli b/src/libraries/stdlib/extlib.mli
index 0335824ac57..5ae88674815 100644
--- a/src/libraries/stdlib/extlib.mli
+++ b/src/libraries/stdlib/extlib.mli
@@ -139,11 +139,6 @@ val opt_of_list: 'a list -> 'a option
     @raise Invalid_argument on lists with more than one argument
     @since Oxygen-20120901 *)
 
-val iteri: (int -> 'a -> unit) -> 'a list -> unit
-(** Same as iter, but the function to be applied take also as argument the
-    index of the element (starting from 0). Tail-recursive
-    @since Nitrogen-20111001 *)
-
 val mapi: (int -> 'a -> 'b) -> 'a list -> 'b list
 (** Same as map, but the function to be applied take also as argument the
     index of the element (starting from 0). Tail-recursive
diff --git a/src/plugins/metrics/gui/metrics_gui_panels.ml b/src/plugins/metrics/gui/metrics_gui_panels.ml
index b51ee8ad149..77b564173ff 100644
--- a/src/plugins/metrics/gui/metrics_gui_panels.ml
+++ b/src/plugins/metrics/gui/metrics_gui_panels.ml
@@ -54,8 +54,8 @@ let display_as_table table_contents (parent:GPack.box) =
       ~rows:(List.length table_contents)
       ~homogeneous:true
       ~packing:parent#pack () in
-  Extlib.iteri (fun i row ->
-      Extlib.iteri (fun j text ->
+  List.iteri (fun i row ->
+      List.iteri (fun j text ->
           table#attach ~left:j ~top:i
             ((GMisc.label ~justify:`LEFT ~text:text ()):>GObj.widget)) row)
     table_contents ;
-- 
GitLab