Last active
December 17, 2015 11:19
-
-
Save chomado/5601105 to your computer and use it in GitHub Desktop.
さっき書いたsortのやつ、case of使わないで書きなおしてみました。case ofとかOCamlのmatch withとか使わなくても普通にパターンマッチできるのスゴイですHaskell感動しました
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mysort2 :: [Int] -> [Int] | |
mysort2 [] = [] | |
mysort2 (first : rest) = insert (mysort2 rest) first | |
where | |
insert [] n = [n] | |
insert (first : rest) n | |
| first < n = first : insert rest n | |
| otherwise = n : first : rest |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment