(* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/. *) (** [(str_mapcat join fn seq)] maps [fn] across the [seq] and concats it with [join]. Returns the new string.*) let str_mapcat (join : string) (fn : 'a -> string) (seq : 'a list) : string = seq |> List.map fn |> String.concat join module StringMap = Hashtbl.Make (String) module StringSet = Set.Make (String) module IntMap = Hashtbl.Make (Int) let identity foo = foo let time f x = let t = Sys.time () in let fx = f x in Printf.printf "Execution time: %fs\n" (Sys.time () -. t); fx let with_return (type ret) f = let exception ReturnEx of ret in let return x = raise_notrace (ReturnEx x) in try f return with | exn -> ( match exn with | ReturnEx v -> v | _ -> raise exn)