【发布时间】:2014-04-24 18:16:12
【问题描述】:
我得到的是
digitIndex :: String -> Int
digitIndex [] = 1
digitIndex (x:xs) =
if
isDigit x == True
then
-- Count list
else
-- Create list with x(x is not a digit)
我的想法是用他传递的所有 x 制作一个列表,所以当他传递一个数字时,他只需要计算列表,这将是数字的位置(当你计算 +1 时) .
唯一的问题是我不知道如何更好地完成工作。各位大神能帮帮我吗?
【问题讨论】:
-
请不要破坏您自己的帖子。如果有必要删除它们,请标记以引起版主注意并要求删除。
标签: string haskell char position int