Last active
September 12, 2020 02:06
-
-
Save ericshortcut/6124d67231a7c73905726c45cde63080 to your computer and use it in GitHub Desktop.
Redecard Haskell intro lecture
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| texto = "String" | |
| texto2 = ['S','t','r','i','n','g'] | |
| texto3 = ['a'..'z'] | |
| lista = [] | |
| lista2 = [1..10] | |
| lista3 = [1,4..] | |
| _map :: (a -> b) -> [a] -> [b] | |
| _map f [] = [] | |
| _map f (x:xs) = [f x] ++ (_map f xs) | |
| _filter :: (a -> Bool) -> [a] -> [a] | |
| _filter f [] = [] | |
| _filter f (x:xs) | |
| | f x = [x] ++ (_filter f xs) | |
| | otherwise = _filter f xs | |
| _filter2 f [] = [] | |
| _filter2 f (x:xs) | |
| | f x = [x] ++ (_filter f xs) | |
| | otherwise = _filter f xs | |
| fun3 acc item = acc ++ "," ++ (show item) | |
| data Company = Enterprise { key::Int, name::String } deriving Show | |
| data Tree a = EmptyTree | Node a (Tree a) (Tree a) deriving (Show, Read, Eq) | |
| arvoreToList :: Show a => Tree a -> IO () | |
| arvoreToList EmptyTree = return () | |
| arvoreToList (Node a l r) = do | |
| arvoreToList l | |
| putStrLn $ show a | |
| arvoreToList r | |
| companies = [ (Enterprise k ("Company" ++ show k)) | k <-[1..] ] | |
| filtroMenor x (Enterprise k _ ) = k > x | |
| extractName (Enterprise _ nome) = nome | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment