Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- lista :: [Int] -> [Int] -> [Int]
- lista [] _ = []
- lista (a:b) s | elem a s == True = lista b s
- | otherwise = a : lista b s
- dif :: [Int] -> [Int] -> [Int]
- dif a b = [ x | x <- a, not (elem x b) ]
- quickSort :: [Int] -> [Int]
- quickSort [] = []
- quickSort (cabeca:cauda) = quickSort [y | y<- cauda, y < cabeca]
- ++ [cabeca]
- ++ quickSort [y | y <- cauda, y>=cabeca]
- maior :: (Int, Int) -> Int
- maior (a,b) = if (a>b) then a else b
- --polimorfismo: apenas muda ->(int,float,char)<- // faz uma geral
- maior2 :: Ord x=> (x,x) -> x --identifica classe para conseguir fazer operacao "maior que"
- maior2 (a,b) = if (a>b) then a else b
- f :: Double -> Double
- f x = let a = x^2 --faz x² em a
- in a^2+2*a+1
- dobra :: Int -> Int
- dobra n = n+n
- dobraLst :: [Int] -> [Int]
- dobraLst [] =[]
- dobraLst (este:aqueles) = (dobra este):(dobraLst aqueles)
- mapInt :: (Int -> Int) -> [Int] -> [Int]
- mapInt f [] = []
- mapInt f (este:aqueles) = (f este) : (mapInt f aqueles)
- quadra :: Int -> Int
- quadra n = n*n
- mudaTodos :: Bool -> [Int] -> [Int]
- mudaTodos f lista = if f
- then mapInt dobra lista
- else mapInt quadra lista
- menu :: IO()
- menu = do putStr "EU//AQUI"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement