1 @kazu_yamamoto 2 3 Haskell = gcd :: Int -> Int -> Int gcd a 0 = a gcd a b = gcd b (a ‘mod‘ b) 4 sum :: Num a => [a] -> a sum [] = 0 sum (x:xs) = x + sum xs sum (x:xs) = (+) x (sum xs) 5 6 (1) sum :: Num a => [a] -> a sum [] = 0 sum (x:xs) = x + sum xs sum :: Num a => [a] -> a sum is = sum’ is 0 where sum’ [] a = a sum’ (x:xs) a = sum’ xs (x+a) 7 (2) ) = (+) fib :: Int -> Integer fib 0 = 0 fib 1