【发布时间】:2018-02-21 15:47:58
【问题描述】:
您好,我在以下 SML 代码中遇到编译错误,有人可以帮忙吗?
Error: operator and operand don't agree [UBOUND match]
operator domain: 'Z list
operand: ''list
in expression:
null mylist
stdIn:4.15-4.24 Error: operator and operand don't agree [UBOUND match]
operator domain: 'Z list
operand: ''list
in expression:
hd mylist
stdIn:6.19-6.36 Error: operator and operand don't agree [UBOUND match]
operator domain: 'Z list
operand: ''list
in expression:
tl mylist
stdIn:6.10-7.21 Error: operator is not a function [circularity]
operator: 'Z
在表达式中: (exists_in (item,tl mylist)) exists_in
代码:
fun exists_in (item: ''int, mylist:''list) =
if null mylist
then false
else if (hd mylist) = item
then true
else exists_in(item, tl mylist)
exists_in(1,[1,2,3]);
【问题讨论】:
-
我认为您的意思是
int和int list或''a和''a list,而不是''int和''list。