我試着做出會返回一個類型的「點」元素的功能:確保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