Last active
September 12, 2020 02:06
-
-
Save ericshortcut/6124d67231a7c73905726c45cde63080 to your computer and use it in GitHub Desktop.
Revisions
-
ericshortcut revised this gist
Sep 12, 2020 . No changes.There are no files selected for viewing
-
ericshortcut created this gist
Aug 5, 2020 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,49 @@ 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