【发布时间】:2012-05-31 15:07:16
【问题描述】:
fun can_move 0 0 0 nil = false
| can_move limit_down V 0 a = true
| can_move limit_down V count a = if ((V-limit_down)>hd a) then false else can_move limit_down V (count-1) tl a ;
嘿,这是我的代码,我只想检查值 V-limit_down 是否低于 int 列表 a 中的数字。我想从 a 列表中检查的参数数量是 V/10 。例如,如果我有 20 V,那么我想检查列表的前两个参数。为什么会出现这个错误?
can_move.sml:1.6-3.114 Error:right-hand-side of clause doesn't agree with function result type
[tycon mismatch]
expression: int -> int -> int list -> bool
result type: int -> int -> (Z' list -> 'Z list) -> int list -> bool
in declaration:
can_move (fn arg =) (fn <pat> => <exp>))
【问题讨论】: