Nightclazz Zenika Bordeaux

Civodul
1,794 views
undefined

Open Source Your Knowledge, Become a Contributor

Technology knowledge has to be shared and made accessible for free. Join the movement.

Create Content

Les listes

Déclarations

Déclaration d'une liste de 1 à 5
listFrom1To5 :: [Int]
listFrom1To5 = [1, 2]
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Déclaration d'une liste de 10 à 1000 à l'aide des ranges
listFrom1To1000 :: [Int]
listFrom1To1000= [1, 2]
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Créer une liste représentant l'ensemble des lettres de l'alphabet
alphabet :: [Char]
alphabet = ['A']
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Déclaration d'une liste de 1000 à 10 à l'aide des ranges
listFrom1000To10 :: [Int]
listFrom1000To10 = [1000]
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Déclaration d'une liste infinie représentant les entiers naturels
allInteger :: [Int]
allInteger = []
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Opérations

Recupérer l'élément à la position
getElementIntoAList :: [Int] -> Int -> Int
getElementIntoAList list position = 0
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Concaténation de deux listes
joinList :: [Int] -> [Int] -> [Int]
joinList firstList secondList = []
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Ajout en début de liste
addToHead :: Int -> [Int] -> [Int]
addToHead element list = []
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Le premier élément de la liste
getHead :: [Int] -> Int
getHead list = 0
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Le dernier élément de la liste
getLast :: [Int] -> Int
getLast list = 0
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
La queue de la liste
getEnd :: [Int] -> [Int]
getEnd list = []
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Tous les éléments de la liste hormis le dernier
getBegin :: [Int] -> [Int]
getBegin list = []
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Tous les entiers naturels au carré
allSquare :: [Int]
allSquare = []
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Tous les entiers naturels au carré qui sont pairs
allEvenSquare :: [Int]
allEvenSquare = []
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Open Source Your Knowledge: become a Contributor and help others learn. Create New Content