diff options
author | Jed Barber <jjbarber@y7mail.com> | 2015-10-22 14:05:21 +1100 |
---|---|---|
committer | Jed Barber <jjbarber@y7mail.com> | 2015-10-22 14:05:21 +1100 |
commit | 0a48ed023ea65d75851ba2a4151100602695a2fd (patch) | |
tree | d3e5b41e148475d5d7aeca164a9ebc8bc99becdd /sort/gnomesort.hs | |
parent | 7dbbe1156c9489151dca6760b1021db426caf84e (diff) |
Cleaning up source a bit
Diffstat (limited to 'sort/gnomesort.hs')
-rw-r--r-- | sort/gnomesort.hs | 19 |
1 files changed, 0 insertions, 19 deletions
diff --git a/sort/gnomesort.hs b/sort/gnomesort.hs deleted file mode 100644 index 2a9b9ce..0000000 --- a/sort/gnomesort.hs +++ /dev/null @@ -1,19 +0,0 @@ - - - -gnomeSort :: Ord a => [a] -> [a] -gnomeSort list = doGnomeSort list 1 - - - -doGnomeSort :: Ord a => [a] -> Int -> [a] -doGnomeSort list pos | pos >= length list = list -doGnomeSort list pos = - if (list !! pos) >= (list !! (pos - 1)) - then doGnomeSort list (pos + 1) - else let list' = (take (pos - 1) list) ++ [list !! pos] ++ - [list !! (pos - 1)] ++ (drop (pos + 1) list) - pos' = if pos > 1 then pos - 1 else pos - in doGnomeSort list' pos' - - |