Haskell说解析错误

时间:2016-03-29 17:56:36

标签: haskell

smallestNumberH (x:xs) n = if(xs==[])then n else (if(x<n) then smallestNumberH xs x else smallestNumberH xs n)
smallestNumber (x:xs) = smallestNumberH (x:xs) x
countmin::[Int]->Int
countmin l:ls = if (ls==[]) then 0 else (if(l==smallestNumber ls) then (1 + countmin ls) else (countmin ls))

它说&#34;解析模式中的错误:countmin&#34;。我试着在ls旁边添加l:但它不起作用。

1 个答案:

答案 0 :(得分:1)

您丢失了与countmin相匹配的模式旁边的括号。将其更改为:

countmin (l:ls) = ...