3 Description: all auxiliary functions
5 Created: 12/08/2013 Modified: 13/08/2013
8 let array_map2 = fun f -> fun a -> fun b ->
9 let n1 = Array.length a in
10 let n2 = Array.length b in
11 if n1 = n2 then Array.init n1 (fun i -> f a.(i) b.(i))
12 else raise (Invalid_argument "Array.map2 size not matched.");;
14 let array_map3 = fun f -> fun a -> fun b -> fun c ->
15 let n1 = Array.length a in
16 let n2 = Array.length b in
17 let n3 = Array.length c in
18 if n1 = n2 && n1 = n3 then Array.init n1 (fun i -> f a.(i) b.(i) c.(i))
19 else raise (Invalid_argument "Array.map3 size not matched.");;
21 let decorate = fun s -> " Faustine -> " ^ s;;
23 let xor : bool -> bool -> bool =
24 fun a -> fun b -> (a || b) && (not (a && b));;
26 let rint : float -> float =
28 if (f -. (floor f)) >= 0.5 then ceil f