Back
Close

Nightclazz Zenika Bordeaux

Civodul
2,135 views

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
Create your playground on Tech.io
This playground was created on Tech.io, our hands-on, knowledge-sharing platform for developers.
Go to tech.io
codingame x discord
Join the CodinGame community on Discord to chat about puzzle contributions, challenges, streams, blog articles - all that good stuff!
JOIN US ON DISCORD
Online Participants