Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --1
- fib :: Integer -> Integer
- fib 0 = 1
- fib 1 = 1
- fib n = fib (n-1) + fib (n-2)
- --2
- mdc :: Int -> Int -> Int
- mdc x y | (x==y) = x
- | (x>y) = mdc (x-y) y
- | otherwise = mdc y x
- --3 REVERSE
- reverse2 :: [a] -> [a]
- reverse2 [] = []
- reverse2 (x:xs) = reverse2 xs ++ [x]
- --4
- unico :: [Integer] -> [Integer]
- unico (x:xs) | elem x xs = unico (apaga x xs)
- | otherwise = x:unico xs
- --APAGAR ELEMENTO LISTA
- apaga:: Integer -> [Integer] -> [Integer]
- apaga _ [] = []
- apaga y (x:xs) | y == x = apaga y xs
- | otherwise = x:apaga y xs
- unico2 l = [x | x<-l, length[y | y<-l, y==x]==1]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement