Saturday, October 30, 2010

Studying F# : Currying

In this article, there is a sample about the finction having more than one parameter:
val sum : int = 8

> printf "%d" sum;;
8val it : unit = ()

And now, we want to do Currying for this function. How should we do?


The answer : This function is already curried!

See another sample (using printfn instead of printf) like below:
> let printfn_decimal = printfn "%d";;

val printfn_decimal : (int -> unit)

> printfn_decimal 8;;
8
val it : unit = ()

No comments:

Post a Comment