, , F #. , , . inline , float:
let inline acc x =
let x = ref (float x)
fun y ->
x := (float y) + !x
!x
:
val inline acc :
^a -> ( ^b -> float)
when ^a : (static member op_Explicit : ^a -> float) and
^b : (static member op_Explicit : ^b -> float)
, float. LISP ( ) , float ( ). - :
> acc 1 2;; // For two integers, it returns float
val it : float = 3.0
> acc 1 2.1;; // integer + float
val it : float = 3.1
> acc 1 "31";; // It even works with strings!
val it : float = 32.0