Last active
July 19, 2017 19:43
-
-
Save Joseph-Bake/a7a59e7d338bf25362c321f0c864c989 to your computer and use it in GitHub Desktop.
急増加関数もどき
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
type I = Integer | |
pfgh :: [I] -> I -> I | |
pfgh list x | null l2 = x+1 | |
| null l1 = fpow (pfgh (head list -1 : tail l2)) x x | |
| otherwise = pfgh (init l1 ++ [x] ++ (head l2 -1) : tail l2) x | |
where | |
(l1,l2) = span (<=0) list | |
fpow :: (a -> a) -> I -> (a -> a) | |
fpow _ 0 = id | |
fpow f x = f. fpow f (x-1) | |
toOI :: I -> I | |
toOI x = pfgh (replicate (fromIntegral x) x) x | |
main :: IO() | |
main = print $ fpow toOI 64 3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment