From 2385aacb1237295a4eacade285e6bc3b542ad06f Mon Sep 17 00:00:00 2001 From: Shinya Sato Date: Sat, 16 Apr 2022 20:25:55 +0900 Subject: Benchmarks for OCaml --- comparison/OCaml/bsort40000.ml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 comparison/OCaml/bsort40000.ml (limited to 'comparison/OCaml/bsort40000.ml') diff --git a/comparison/OCaml/bsort40000.ml b/comparison/OCaml/bsort40000.ml new file mode 100644 index 0000000..45744bd --- /dev/null +++ b/comparison/OCaml/bsort40000.ml @@ -0,0 +1,23 @@ +let rec bs (alist : int list) n = + match alist with + (x::y::ys) -> + if x xs;; + + +let rec go xs n = + match n with + 0 -> xs + | n -> go (bs xs n) (n-1);; + +let bsort xs = go xs (List.length(xs) - 1);; + + +let rec mkRandList n = + match n with + 0 -> [] + | n -> (Random.int 10000)::(mkRandList (n-1));; + +let main = bsort (mkRandList 40000);; + -- cgit v1.2.3