diff options
| author | Shinya Sato <shinnya.sato@gmail.com> | 2022-05-02 09:50:21 +0900 |
|---|---|---|
| committer | Shinya Sato <shinnya.sato@gmail.com> | 2022-05-02 09:50:21 +0900 |
| commit | df4949f8b08cbe3cfd99933d5bb14a373f47f2dd (patch) | |
| tree | c516c3c45d79a4843114ddd44a83b9ca87250cb7 /comparison/OCaml/bsort40000.ml | |
| parent | 7ea48cd96551247ecc763a5e42404ffa3464d0b0 (diff) | |
| parent | 779860e35f5c67c7fd48ef876784f87afcfdb321 (diff) | |
| download | inpla-df4949f8b08cbe3cfd99933d5bb14a373f47f2dd.tar.gz inpla-df4949f8b08cbe3cfd99933d5bb14a373f47f2dd.zip | |
Merge branch 'develop'
Diffstat (limited to 'comparison/OCaml/bsort40000.ml')
| -rw-r--r-- | comparison/OCaml/bsort40000.ml | 12 |
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)));; |
