Mapa mental
MODULES
Conteúdo do mapa
MODULES
set of functions, types, class types
Program
- Set of modules
Generic module
- use for a lot of programs
standard haskell library
- prelude module
- import modules
- Import <module name>
- Import modules using GHCI
- :m + Data.List
- :m + Data.List Data.Map Data.Set
- import qualified Data.Map
DATA.LIST
- intersperse '.' "MONKEY" => "M.O.N.K.E.Y"
- transpose [[1,2,3],[4,5,6],[7,8,9]] [[1,4,7],[2,5,8],[3,6,9]]
- concat [[3,4,5],[2,3,4],[2,1,1]] [3,4,5,2,3,4,2,1,1]
- any (==4) [2,3,5,6,1,4] True
- all (>4) [6,9,10] True
- take 10 $ iterate (*2) 1 [1,2,4,8,16,32,64,128,256,512]
- splitAt 3 "heyman" ("hey","man")
- takeWhile (>3) [6,5,4,3,2,1,2,3,4,5,4,3,2,1] [6,5,4]
- break (==4) [1,2,3,4,5,6,7] ([1,2,3],[4,5,6,7])
- sort [8,5,3,2,1,6,4,2] [1,2,2,3,4,5,6,8]
- group [1,1,1,1,2,2,2,2,3,3,2,2,2,5,6,7] [[1,1,1,1],[2,2,2,2],[3,3],[2,2,2],[5],[6],[7]]
- "cat" `isInfixOf` "im a cat burglar" True
- find (>4) [1,2,3,4,5,6] Just 5
- The result that throws the function is Maybe
- Nub: Clears repeated elements
- more generic variants: they are called generic Length, generic Take, generic Drop, genericSplitAt, genericIndex and genericReplicate
- use or return any number unlike its non-generic variants.
- The nub, delete, union, intersect and group functions have their most general functions called nubBy, deleteBy, unionBy, intersectBy and groupBy.
- The functions sort, insert, maximum and minimum also have their more general equivalents
- sortBy, insertBy, maximumBy and minimumBy
DATA.CHAR
- functions that deal with characters.
- They return a Boolean each one of them.
- isControl: check if a character is control or not.
- isLower: check if a character is in lowercase.
- isAlpha: check if a character is a letter.
- isPrim: check if a character is printable. The control characters, for example, are not
- isHexDigit: check if a character is a hexadecimal digit.
- isSeparator: checks if a character is a Unicode space or separator.
- isAsciiLower: checks if a character is lowercase and is also ascii.
- toLower: converts a character to lowercase.
- Coding function
- encode :: Int -> String -> String encode shift msg = let ords = map ord msg shifted = map (+ shift) ords in map chr shifted
- functions that deal with characters.
DATA.MAP
- The association lists (also called dictionaries).
- They are used to store keys and values
- fromList
- Empty
- Insert
- Singleton
- Member
- fromListWith: When using it in the following function it does not discard the duplicated keys, but it combines its values
- map and filter work similarly to their list equivalents
- The association lists (also called dictionaries).
DATA.SET
- Set operations
- sets like those of mathematics.
- Mix between lists and dictionaries.
- Mas eficientes que las listas.
- Set operations
Informações
- Descrição
- Mapa Mental sobre MODULES, criado por CASTILLO ZAMBRANO LUIS FELIPE em 12-03-2018.
- Criado por
- CASTILLO ZAMBRANO LUIS FELIPE
- Visualizações
- 1
- Avaliação