【发布时间】:2013-03-31 20:29:31
【问题描述】:
我正在实现一个递归函数,我希望停止条件是 (2*scope) 这是函数的参数
sortByManhattanDistance agent (2*scope) scope xs sortedNearFoodList = sortedNearFoodList
sortByManhattanDistance agent n scope xs sortedNearFoodList = sortByManhattanDistance agent (n+1) scope xs (sorted ++ sortedNearFoodList)
where sorted=compareManhattanDistance xs agent n
拥抱抱怨:Syntax error in declaration (unexpected symbol "*")
这是否意味着我不能在参数上使用某些函数?
提前致谢
【问题讨论】:
-
您不能使用
(2*scope)作为输入参数值。这不是一个有效的语法 -
是的,我忘记了。谢谢!