私はリスト内の1つの要素の値にしたいいくつかのリストを追加し、だから私は[」Haskellはで一緒に
changePoint :: (Int,Int) -> [[[Char]]] -> [[Char]]
changePoint (x,y) maze = let
linelement = maze !! (y-1)
-- value ["X"," "," ",...," ","X"]
rowelement = chunksOf 1 $ head linelement
-- type:[[a]]; value ["X"," "," "," "," "," "," "," "," "," "," "," "," ","X"]
l = length rowelement
list = take (x-1) rowelement
-- in take (x-1) rowelement -- ["X"]
in take (x-1) rowelement ++ (["."] : (drop (x) rowelement))
が、私はリストを追加「を取る(X-1)rowelement」にしたい行なったし、 」。 "]" と "ドロップ(x)のrowelement "] "" ["、リストのタイプは[[]]
Couldn't match expected type ‘Char’ with actual type ‘[Char]’
In the expression: "."
In the first argument of ‘(:)’, namely ‘["."]’
In the second argument of ‘(++)’, namely
‘(["."] : (drop (x) rowelement))’ Failed, modules loaded: none.
x = 2 .
になります私は問題がある知っている" が、私は本当にドン」それを修正する方法。
真のリターンはあなたがsomefunction
の種類を取得するために:t somefunction
を使用することができ、GHCiので["X","."," "," ",..,"X" ]
'['] '最初の例で必要実際います。 – tomahh