问题描述:

Maybe I'm missing something obvious. In the F# interpreter, some things works as I expect:

> 10;;

val it : int = 10

> int 10;;

val it : int = 10

> 10L;;

val it : int64 = 10L

However, some things do not. I would expect the following to return int64, not int, and I would not expect 10 to be converted to 0.

> int64 10;;

val it : int = 0

> int64;;

val it : ('a -> int) = <fun:[email protected]>

How do I convert an integer to an int64?

网友答案:

Is it possible you've accidentally redefine int64? Something like let inline int64 = int. When I try I get the expected result:

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:[email protected]>
>
相关阅读:
Top