gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-01 00:25:09 24 4
gpt4 key购买 nike

也许我遗漏了一些明显的东西。在 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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com