下面的代碼只是一種原型。我想知道的是爲什麼它不能編譯。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,來自)';)引起的 –
,但儘量不惹到很多與原來的功能和冒着失去我的觀點:) –