我正在阅读Robert Pickering的 F# 基础。当我尝试运行本书中的第一个示例(如下)时,我在函数打印处遇到运行时错误,“无法解析格式字符串'缺少格式说明符'”
#mytestapp
let message = "Hello
World\r\n\t!"
let dir = @"c:\projects"
let bytes = "bytesbytesbytes"B
let xA = 0xFFy
let xB = 0o7777un
let xC = 0b10010UL
let print x = printfn "A%" x
let main() =
print message;
print dir;
print bytes;
print xA;
print xB;
print xC
main()
输出应该是(根据书):
“你好\n世界\r\n\t!”
"c:\projects"
[|98uy; 121uy; 116uy; 101uy; 115uy; 98uy; 121uy; 116uy; 101uy; 115uy; 98uy;
121uy; 116uy; 101uy; 115uy|] -1y
4095
18UL
我想,也许我没有应该引用的东西?