我试着做出会返回一个类型的“点”元素的功能:确保SML特定类型的结果
type point = {x : int, y : int};
fun pointadd (p1: point, p2: point) = (((#x p1) + (#x p2)), ((#y p1) + (#y p2)));
但SMLNJ似乎并不理解我的意图,其结果应该是类型“点”,以及:
use "test1.sml";
[opening test1.sml]
type point = {x:int, y:int}
val pointadd = fn : point * point -> int * int
现货!问题解决了:) – loldrup 2009-07-07 07:48:51