Mic*_*kel 1 haskell list-comprehension list ghci
在执行以下操作时,我收到错误"不在范围:x"中...
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]]
Run Code Online (Sandbox Code Playgroud)
但是,如果我删除了2:nd线的警卫GHCI编译而没有给我任何错误.
你能帮我理解我做错了什么吗?
qba*_*qba 13
尝试 [ fst x | x <- posSud , isBlank (snd x) ]