aboutsummaryrefslogtreecommitdiff
path: root/comparison/OCaml/bsort40000.ml
diff options
context:
space:
mode:
Diffstat (limited to 'comparison/OCaml/bsort40000.ml')
-rw-r--r--comparison/OCaml/bsort40000.ml12
1 files changed, 8 insertions, 4 deletions
diff --git a/comparison/OCaml/bsort40000.ml b/comparison/OCaml/bsort40000.ml
index 2a06e85..80c222e 100644
--- a/comparison/OCaml/bsort40000.ml
+++ b/comparison/OCaml/bsort40000.ml
@@ -1,3 +1,5 @@
+open Format
+
let rec bs (alist : int list) n =
match alist with
(x::y::ys) ->
@@ -11,9 +13,12 @@ let rec go xs n =
0 -> xs
| n -> go (bs xs n) (n-1);;
-let bsort xs = go xs (List.length(xs) - 1);;
-
+let bsort alist =
+ match alist with
+ [] -> []
+ | xs -> go xs (List.length(xs) - 1);;
+
let rec mkRandList n =
match n with
0 -> []
@@ -31,5 +36,4 @@ let rec validation alist =
| x::xs -> validation_cons x xs;;
-let main = validation (bsort (mkRandList 40000));;
-
+let () = print_bool (validation (bsort (mkRandList 40000)));;