f# - 在 F# interactive 中不小心重新定义了 int64

标签 f#

也许我遗漏了一些明显的东西。在 F# 解释器中,有些事情如我所料:

> 10;;
val it : int = 10
> int 10;;
val it : int = 10
> 10L;;
val it : int64 = 10L

但是,有些事情不是。我希望以下返回 int64,而不是 int,我不希望 10 转换为 0。

> int64 10;;
val it : int = 0
> int64;;
val it : ('a -> int) = <fun:clo@143-3>

如何将整数转换为 int64?

最佳答案

您是否可能不小心重新定义了 int64?类似于 let inline int64 = int。当我尝试时,我得到了预期的结果:

Microsoft (R) F# 2.0 Interactive build 4.0.40219.1
Copyright (c) Microsoft Corporation. All Rights Reserved.

For help type #help;;

> int64 20;;
val it : int64 = 20L
> int64;;
val it : (int -> int64) = <fun:it@2>
>

关于f# - 在 F# interactive 中不小心重新定义了 int64,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9291716/

相关文章:

visual-studio - Visual Studio 中使用 FSharp 的相对目录路径

f# - 我如何满足编译器消除警告0052的要求?

functional-programming - 如何积累 Observable

f# - 如何在 F# 模式匹配中 "compress"相似分支

android - F# on Mono for Android

f# - 在 F# 中通过公共(public) ID 将多个数据列表合并在一起

generics - F#:在此程序点之前已在非统一实例化中使用了通用成员

c# - 将多个 .NET 二进制文件合并在一起?

string - 为什么 F# 字符串不能在三引号中以双引号结尾?

f# - 可以在 F# 中使用 CSVProvider 读取用 gzip (tvs.gz) 压缩的 URL 吗?