-- Computes the square of a number. square :: Int -> Int square x = x * x -- Computes the minimum of two numbers mymin :: Int -> Int -> Int mymin x y = if x Int fac n = if n==0 then 1 else n * fac (n-1) -- Computes the n-th Fibonacci number. Mathematical definition! fib1 :: Int -> Int fib1 n = if n==0 then 0 else if n==1 then 1 else fib1 (n-1) + fib1 (n-2) -- Computes the n-th Fibonacci number with the n-th and (n-1)-th Fib. number. fib2' :: Int -> Int -> Int -> Int fib2' fibn fibnp1 n = if n==0 then fibn else fib2' fibnp1 (fibn + fibnp1) (n-1) -- Computes the n-th Fibonacci number. fib2 :: Int -> Int fib2 n = fib2' 0 1 n