X-Git-Url: https://svn.cri.ensmp.fr/git/Faustine.git/blobdiff_plain/f59ac471aa5a080301d70e7d7e1e81f34151ba2f..a186a0b2f3c996e9f17dd96e9f548e81f6447fe0:/interpretor/aux.ml diff --git a/interpretor/aux.ml b/interpretor/aux.ml index 9463cae..a33e722 100644 --- a/interpretor/aux.ml +++ b/interpretor/aux.ml @@ -5,11 +5,6 @@ Created: 12/08/2013 Modified: 13/08/2013 *) - -let array_map = fun f -> fun a -> - let n = Array.length a in - Array.init n (fun i -> f a.(i));; - let array_map2 = fun f -> fun a -> fun b -> let n1 = Array.length a in let n2 = Array.length b in @@ -22,3 +17,13 @@ let array_map3 = fun f -> fun a -> fun b -> fun c -> let n3 = Array.length c in if n1 = n2 && n1 = n3 then Array.init n1 (fun i -> f a.(i) b.(i) c.(i)) else raise (Invalid_argument "Array.map3 size not matched.");; + +let decorate = fun s -> " Faustine -> " ^ s;; + +let xor : bool -> bool -> bool = + fun a -> fun b -> (a || b) && (not (a && b));; + +let rint : float -> float = + fun f -> + if (f -. (floor f)) >= 0.5 then ceil f + else floor f;;