这段代码有什么问题?Haskell数量问题实例
rectangle :: Int -> Int -> String
rectangle i j
| i < 0 || j < 0 = ""
| otherwise = concatenate(i) ++ "n/" ++ (rectangle i) j-1
concatenate :: Int -> String
concatenate i
| i <= 0 = ""
| otherwise = "*" ++ concatenate(i-1)
这是错误我得到
ERROR line 3 - Instance of Num [Char] required for definition of rectangle
这应该是它做什么(例如)
Main> putStr (rectangle 3 4)
****
****
****
@Ingo对不起,刚刚发现并修复它,但出现同样的错误 – user2964960
没有第二个参数为矩形,你正在做'字符串++(智力 - > String)' – afsantos
“但是如果我把它放在提示符上,它会在范围'n'中表示不是。”说'让因子n ='等等。 GHCi提示符的行为就像是在一个非常大的'do'语句中(没有'do')。 – 2013-12-08 11:57:47