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/Haskell/qsort-800000.hs | |
| parent | 950e2cb2184cb7ead93ba8df691a190598ed242f (diff) | |
| parent | 429543c748aaf81b2a4207318eb5a05259469b21 (diff) | |
| download | inpla-7ea48cd96551247ecc763a5e42404ffa3464d0b0.tar.gz inpla-7ea48cd96551247ecc763a5e42404ffa3464d0b0.zip | |
Merge branch 'develop'
Diffstat (limited to 'comparison/Haskell/qsort-800000.hs')
| -rw-r--r-- | comparison/Haskell/qsort-800000.hs | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/comparison/Haskell/qsort-800000.hs b/comparison/Haskell/qsort-800000.hs index 2a9d60d..72f7a03 100644 --- a/comparison/Haskell/qsort-800000.hs +++ b/comparison/Haskell/qsort-800000.hs @@ -15,10 +15,12 @@ part pivot (x:xs) where (below, above) = part pivot xs + {- main = print $ qsort [3,2,8,5] -} + randomList :: Int -> IO([Int]) randomList 0 = return [] randomList n = do @@ -27,7 +29,15 @@ randomList n = do return (r:rs) +validation [] = True +validation (x:xs) = validation_cons x xs +validation_cons x [] = True +validation_cons x (y:ys) = + if x<=y then validation_cons y ys + else False + + main = do list <- randomList 800000 let sorted = qsort list - print (take 10 sorted) + print (validation sorted) |
