Compréhension de la liste de Haskell
-
10-07-2019 - |
Question
Je reçois le message d'erreur & "; Pas dans l'étendue: x &"; en procédant comme suit ...
blanks :: Sudoku -> [Pos]
blanks (Sudoku su) = [ fst x | x <- posSud | isBlank (snd x) ]
where
isBlank Nothing = True
isBlank _ = False
posSud = zip ixPos (concat su)
ixPos = zip ixRows ixCols
ixCols = concat (replicate 9 [0..8])
ixRows = [floor (x / 9) | x <- [0..81]]
Cependant, si je supprime la garde de la 2: e ligne, GHCI compile sans me donner d’erreur.
Pouvez-vous m'aider à comprendre ce que je fais mal?
La solution
essayez [ fst x | x <- posSud , isBlank (snd x) ]
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow