aboutsummaryrefslogtreecommitdiff
path: root/src/boot/util
diff options
context:
space:
mode:
authorPatrick Walton <[email protected]>2010-07-02 18:01:58 -0700
committerPatrick Walton <[email protected]>2010-07-02 18:02:46 -0700
commit667d46bef9a17616e7aabfdd80f9646b6bde6191 (patch)
tree68e0b3654b98df73ba7752b351f722bae134b2bd /src/boot/util
parentDeja vu all over again. Something makes me think this is a usability hazard. (diff)
downloadrust-667d46bef9a17616e7aabfdd80f9646b6bde6191.tar.xz
rust-667d46bef9a17616e7aabfdd80f9646b6bde6191.zip
Add an arr_iter2 function to common.ml
Diffstat (limited to 'src/boot/util')
-rw-r--r--src/boot/util/common.ml5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/boot/util/common.ml b/src/boot/util/common.ml
index 5c381b81..168c9f0a 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 =