我需要使用haskell计算出现在字符列表中的位数。
例如。 ['2','3','d','r','t','5']
将输出3
我设法使用字符串完成此操作,但是在使用字符时却无法使其工作
这是我的字符串代码
isnumber' :: String -> Bool
isnumber' s = case (reads s) :: [(Int,String)] of
[(_,"")] -> True
_ -> False
counta :: [String] -> Int
counta = length . filter isnumber'
例如['2','5']
将输出3