【发布时间】:2015-01-06 23:07:06
【问题描述】:
我在 SMLNJ 中有这个代码:
val reduce = fn : C list -> C list * int
datatype C = R | G | B | Y | SR | SG | SB | SY | DR | DG | DB | DY | P | W | W';
fun exhaustiveReduce(cList)=
let
fun helper((cList, score), prevScore, flag)=
if (0 = score andalso flag = true) then
(cList,prevScore)
else
helper(reduce(cList), prevScore+score, true)
in
helper((cList, 0), 0, false)
end
当我尝试运行以下行时:
exhaustiveReduce ([B,B,B,G,G,G,G,Y,R,R,R,Y,Y,G,G,G])
我收到此错误:
我明白意思是我试图向函数发送一个参数
它不希望得到,但?. 是什么意思?我该如何解决?
附:我看了这里:What does 'int ?. tree' mean in an SML error message?,但没有发现它很有用。
谢谢
【问题讨论】: