Skip to content
Snippets Groups Projects
Commit bdec3a28 authored by Allan Blanchard's avatar Allan Blanchard
Browse files

[Extlib] removed iteri (List.iteri)

parent 8cdabbb1
No related branches found
No related tags found
No related merge requests found
...@@ -87,7 +87,8 @@ process_file () ...@@ -87,7 +87,8 @@ process_file ()
sedi "$file" \ sedi "$file" \
-e 's/Extlib\.id/Fun.id/g' \ -e 's/Extlib\.id/Fun.id/g' \
-e 's/Extlib\.swap/Fun.flip/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 # this line left empty on purpose
} }
......
...@@ -165,8 +165,6 @@ let opt_of_list = ...@@ -165,8 +165,6 @@ let opt_of_list =
| [a] -> Some a | [a] -> Some a
| _ -> raise (Invalid_argument "Extlib.opt_of_list") | _ -> 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 mapi f l =
let res = let res =
snd (List.fold_left (fun (i,acc) x -> (i+1,f i x :: acc)) (0,[]) l) snd (List.fold_left (fun (i,acc) x -> (i+1,f i x :: acc)) (0,[]) l)
......
...@@ -139,11 +139,6 @@ val opt_of_list: 'a list -> 'a option ...@@ -139,11 +139,6 @@ val opt_of_list: 'a list -> 'a option
@raise Invalid_argument on lists with more than one argument @raise Invalid_argument on lists with more than one argument
@since Oxygen-20120901 *) @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 val mapi: (int -> 'a -> 'b) -> 'a list -> 'b list
(** Same as map, but the function to be applied take also as argument the (** Same as map, but the function to be applied take also as argument the
index of the element (starting from 0). Tail-recursive index of the element (starting from 0). Tail-recursive
......
...@@ -54,8 +54,8 @@ let display_as_table table_contents (parent:GPack.box) = ...@@ -54,8 +54,8 @@ let display_as_table table_contents (parent:GPack.box) =
~rows:(List.length table_contents) ~rows:(List.length table_contents)
~homogeneous:true ~homogeneous:true
~packing:parent#pack () in ~packing:parent#pack () in
Extlib.iteri (fun i row -> List.iteri (fun i row ->
Extlib.iteri (fun j text -> List.iteri (fun j text ->
table#attach ~left:j ~top:i table#attach ~left:j ~top:i
((GMisc.label ~justify:`LEFT ~text:text ()):>GObj.widget)) row) ((GMisc.label ~justify:`LEFT ~text:text ()):>GObj.widget)) row)
table_contents ; table_contents ;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment