Open Source Your Knowledge, Become a Contributor
Technology knowledge has to be shared and made accessible for free. Join the movement.
Les listes
DĂ©clarations
DĂ©claration d'une liste de 1 Ă 5
1
2
3
listFrom1To5 :: [Int]
listFrom1To5 = [1, 2]
Enter to Rename, Shift+Enter to Preview
DĂ©claration d'une liste de 10 Ă 1000 Ă l'aide des ranges
1
2
3
listFrom1To1000 :: [Int]
listFrom1To1000= [1, 2]
Enter to Rename, Shift+Enter to Preview
Créer une liste représentant l'ensemble des lettres de l'alphabet
1
2
3
alphabet :: [Char]
alphabet = ['A']
Enter to Rename, Shift+Enter to Preview
DĂ©claration d'une liste de 1000 Ă 10 Ă l'aide des ranges
1
2
3
listFrom1000To10 :: [Int]
listFrom1000To10 = [1000]
Enter to Rename, Shift+Enter to Preview
Déclaration d'une liste infinie représentant les entiers naturels
1
2
allInteger :: [Int]
allInteger = []
Enter to Rename, Shift+Enter to Preview
Opérations
Recupérer l'élément à la position
1
2
3
getElementIntoAList :: [Int] -> Int -> Int
getElementIntoAList list position = 0
Enter to Rename, Shift+Enter to Preview
Concaténation de deux listes
1
2
3
joinList :: [Int] -> [Int] -> [Int]
joinList firstList secondList = []
Enter to Rename, Shift+Enter to Preview
Ajout en début de liste
1
2
3
addToHead :: Int -> [Int] -> [Int]
addToHead element list = []
Enter to Rename, Shift+Enter to Preview
Le premier élément de la liste
1
2
3
getHead :: [Int] -> Int
getHead list = 0
Enter to Rename, Shift+Enter to Preview
Le dernier élément de la liste
1
2
3
getLast :: [Int] -> Int
getLast list = 0
Enter to Rename, Shift+Enter to Preview
La queue de la liste
1
2
3
getEnd :: [Int] -> [Int]
getEnd list = []
Enter to Rename, Shift+Enter to Preview
Tous les éléments de la liste hormis le dernier
1
2
3
getBegin :: [Int] -> [Int]
getBegin list = []
Enter to Rename, Shift+Enter to Preview
Tous les entiers naturels au carré
1
2
3
allSquare :: [Int]
allSquare = []
Enter to Rename, Shift+Enter to Preview
Tous les entiers naturels au carré qui sont pairs
1
2
3
allEvenSquare :: [Int]
allEvenSquare = []
Enter to Rename, Shift+Enter to Preview
Open Source Your Knowledge: become a Contributor and help others learn. Create New Content