X-Git-Url: https://scm.cri.mines-paristech.fr/git/Faustine.git/blobdiff_plain/50baab1849bddf73ee88b54f52b28060de1ce289..02c1ef905d2101df872ccccccb2e4c7c0a508571:/interpreter/aux.ml?ds=inline diff --git a/interpreter/aux.ml b/interpreter/aux.ml index 0564c30..4709724 100644 --- a/interpreter/aux.ml +++ b/interpreter/aux.ml @@ -40,3 +40,9 @@ let format_of_file : string -> string = let fragments = Str.split (Str.regexp "\.") path in let n = List.length fragments in List.nth fragments (n - 1);; + +let transpose : int -> 'a array array -> 'a array array = + fun width -> fun matrix -> + let get_element = fun i -> fun array -> array.(i) in + let get_column = fun m -> fun i -> Array.map (get_element i) m in + Array.init width (get_column matrix);; \ No newline at end of file