下面的代码只是一种原型。我想知道的是为什么它不能编译。ML代码错误的原因
fun test(list) =
let
fun inner(list) =
let
val from = #1(hd(list))
in
if null(tl(list)) = false then innerinner(tl(list),from)
else false
end
fun innerinner(list,from) =
if #2(hd(list)) = from then true
else if null(list) = false then innerinner(tl(list),from)
else false
in
inner(list)
end;
错误消息是:
test.txt:7.34-7.44 Error: unbound variable or constructor: innerinner
test.txt:3.2-9.6 Error: unresolved flex record
(can't tell what fields there are besides #1)
test.txt:10.2-13.13 Error: unresolved flex record
(can't tell what fields there are besides #2)
uncaught exception Error
raised at: ../compiler/Toplevel/interact/evalloop.sml:66.19-66.27
....
我ML编程的一种初学者。任何人都可以教我什么是错的?
或许'X1 =从否则别指望innerinner(XS,来自)';)引起的 –
,但尽量不惹到很多与原来的功能和冒着失去我的观点:) –