From 667d46bef9a17616e7aabfdd80f9646b6bde6191 Mon Sep 17 00:00:00 2001 From: Patrick Walton Date: Fri, 2 Jul 2010 18:01:58 -0700 Subject: [PATCH] Add an arr_iter2 function to common.ml --- src/boot/util/common.ml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/boot/util/common.ml b/src/boot/util/common.ml index 5c381b81206..168c9f0ad87 100644 --- a/src/boot/util/common.ml +++ b/src/boot/util/common.ml @@ -430,6 +430,11 @@ let arr_map2 (f:'a -> 'b -> 'c) (a:'a array) (b:'b array) : 'c array = Array.init (Array.length a) (fun i -> f a.(i) b.(i)) ;; +let arr_iter2 (f:'a -> 'b -> unit) (a:'a array) (b:'b array) : unit = + assert ((Array.length a) = (Array.length b)); + Array.iteri (fun i a_elem -> f a_elem b.(i)) a +;; + let arr_for_all (f:int -> 'a -> bool) (a:'a array) : bool = let len = Array.length a in let rec loop i =