diff options
| author | Shinya Sato <shinnya.sato@gmail.com> | 2022-04-28 21:47:28 +0900 |
|---|---|---|
| committer | Shinya Sato <shinnya.sato@gmail.com> | 2022-04-28 21:47:28 +0900 |
| commit | 7ea48cd96551247ecc763a5e42404ffa3464d0b0 (patch) | |
| tree | fd1b63ab48d98a9243d3053522e17e31b9dc033f /comparison/OCaml/isort40000.ml | |
| parent | 950e2cb2184cb7ead93ba8df691a190598ed242f (diff) | |
| parent | 429543c748aaf81b2a4207318eb5a05259469b21 (diff) | |
| download | inpla-7ea48cd96551247ecc763a5e42404ffa3464d0b0.tar.gz inpla-7ea48cd96551247ecc763a5e42404ffa3464d0b0.zip | |
Merge branch 'develop'
Diffstat (limited to 'comparison/OCaml/isort40000.ml')
| -rw-r--r-- | comparison/OCaml/isort40000.ml | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/comparison/OCaml/isort40000.ml b/comparison/OCaml/isort40000.ml index 686a7f6..92e127d 100644 --- a/comparison/OCaml/isort40000.ml +++ b/comparison/OCaml/isort40000.ml @@ -1,11 +1,3 @@ -(* -let rec insert x ylist = - match ylist with - [] -> [x] - | y::ys when x<=y -> x::y::ys - | y::ys -> y::(insert x ys);; -*) - let rec insert x ylist = match ylist with [] -> [x] @@ -26,5 +18,17 @@ let rec mkRandList n = 0 -> [] | n -> (Random.int 10000)::(mkRandList (n-1));; -let main = isort (mkRandList 40000);; + +let rec validation alist = + let rec validation_cons x blist = + match blist with + [] -> true + | y::ys -> if x<=y then (validation_cons y ys) else false + in + match alist with + [] -> true + | x::xs -> validation_cons x xs;; + + +let main = validation(isort (mkRandList 40000));; |
