Possible Duplicate:
F# explicit match vs function syntax

Hello,

I am learning F# and am confused by 'fun' and 'function' keywords. My understanding is that these are sort of the same thing.

// Use 'fun'
let testFunction1 = fun argument -> match argument with
                                    | Some(x) -> x
                                    | None    -> 0

// Use 'function'
let testFunction2 = function
                    | Some(x) -> x
                    | None    -> 0

Is 'function' just shorthand for "fun x -> match x with"? Is there any runtime / optimization difference between the two? Why would I prefer to use one over the other?

As it stands, 'function' just seems to make code harder to read. Am I missing something?

f#
Edit
Report