【发布时间】:2014-04-29 00:48:40
【问题描述】:
fun square(x:int) = x*x;
map (~, map (square, map (~, [1, 2, 3] )));
是否只是三个数字(1、4、9)的平方? 我尝试在新泽西州的 SML 上运行它,但一直收到此错误...
- fun square(x:int) = x*x;
val square = fn : int -> int
- map(~, map(square, map(~,[1,2,3])));
stdIn:3.11-3.35 Error: operator and operand don't agree [tycon mismatch]
operator domain: 'Z -> 'Y
operand: ('X -> 'X) * int list
in expression:
map (~,1 :: 2 :: <exp> :: <exp>)
stdIn:3.4-3.36 Error: operator and operand don't agree [tycon mismatch]
operator domain: 'Z -> 'Y
operand: (int -> int) * _
in expression:
map (square,map (~,<exp> :: <exp>))
stdIn:3.1-3.36 Error: operator and operand don't agree [tycon mismatch]
operator domain: 'Z -> 'Y
operand: ('X -> 'X) * _
in expression:
map (~,map (square,map <exp>))
-
【问题讨论】:
标签: ml