> (1, 2, 3);;
val it : int * int * int = (1, 2, 3)
> printfn "%d" (1, 2 ,3);;
printfn "%d" (1, 2 ,3);;
--------------^^^^^^^
stdin(2,15): error FS0001: The type '('a * 'b * 'c)' is not compatible with any of the types byte,int16,int32,int64,sbyt
e,uint16,uint32,uint64,nativeint,unativeint, arising from the use of a printf-style format string
Run Code Online (Sandbox Code Playgroud)
如何在不创建附加功能的情况下打印此类型?
您可以使用格式化程序%A打印任何类型:
printfn "%A" (1, 2, 3);;
Run Code Online (Sandbox Code Playgroud)
否则,您将需要解压缩您的元组以打印它,因为没有特定于元组的格式化程序.