Created
October 6, 2015 04:20
-
-
Save motokiee/a9d19881e4cb2fe9541c to your computer and use it in GitHub Desktop.
すごいH本の再帰関数あたり #CodePiece
This file contains hidden or 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
| zip' :: [a] ->[b] -> [(a,b)] | |
| zip' _ [] = [] | |
| zip' [] _ = [] | |
| zip' (x:xs) (y:ys) = (x,y) : zip' xs ys | |
| elem' :: (Eq a) => a -> [a] -> Bool | |
| elem' a [] = False | |
| elem' a (x:xs) | |
| | a == x = True | |
| | otherwise = a `elem'` xs | |
| quicksort :: (Ord a) => [a] -> [a] | |
| quicksort [] = [] | |
| quicksort (x:xs) = | |
| let smallOrEqual = [a | a <- xs, a <= x] | |
| larger = [a | a <- xs, a > x] | |
| in quicksort smallOrEqual ++ [x] ++ quicksort larger |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment