Skip to content

Instantly share code, notes, and snippets.

@lesguillemets
Created October 11, 2013 11:32
Show Gist options
  • Save lesguillemets/6933254 to your computer and use it in GitHub Desktop.
Save lesguillemets/6933254 to your computer and use it in GitHub Desktop.
b :: Integral a => a -> a -> a --なんか数が2個入ったら中で色々やって数が1個出て来るような b っていうものがあるとするわね
b m n
| m == 0 = f n -- b の頭に 0, 尻になんか入ったらこうなる
| n == 0 = b (m-1) 1 -- b の頭に 0 より大きい数,尻に 0 が入った場合こうなる
| otherwise = b m $ b (m+1) n -- b の頭にも尻にも 0 でない数が入った場合こうなる
f :: Integral a => a -> a -- f っていうのは数が1個入ったら中で色々やって数が1個出てくるようなもの
f n = n + 1 -- この f は入った数に 1 を加えて出すというルールってことにしましょうか
g x = b x x -- g をこのように定める
main = do
putStrLn $ show $ g 3 -- オラオラオラオラオラオラ
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment