1
遇到了麻煩,從一個輔助功能輸出到我的函數的輸出相匹配,我用下面的代碼我:Haskell-類型匹配
getSemiDiag :: [[Maybe Player]] -> Int -> Int -> [Maybe Player]
getSemiDiag [] _ _ = []
getSemiDiag (x:xs) start size = if start > (size -1)
then []
else (x !! start) : (getSemiDiag xs (start+1) size)
semiRight :: [[Maybe Player]] -> Int -> Int -> [[Maybe Player]]
semiRight [] _ _ = []
semiRight (x:xs) start size = if start > (size -1)
then []
else (getSemiDiag x start size) : (semiRight xs (start+1) size)
功能semiRight不會,儘管我盡了最大努力匹配。有什麼想法嗎?
我不知道你想達到什麼,但你傳遞一個'[也許播放器]''到哪裏getSemiDiag'一個期望了' [[也許玩家]]'。你的意思是讓'getSemiDiag(x:xs)開始大小:semiRight xs(start + 1)size'? –
'然後[]'應該可以'然後[[]]' – Wes
謝謝! – lopezrican304