F# explicit match vs function syntax

后端 未结 8 2491
耶瑟儿~
耶瑟儿~ 2020-12-04 23:21

Sorry about the vague title, but part of this question is what these two syntax styles are called:

let foo1 x = 
    match x with
    | 1 -> \"one\"
    |         


        
8条回答
  •  广开言路
    2020-12-04 23:31

    Just for completeness sake, I just got to page 321 of Expert FSharp:

    "Note, Listing 12-2 uses the expression form function pattern-rules -> expression. This is equivalent to (fun x -> match x with pattern-rules -> expression) and is especially convenient as a way to define functions working directly over discriminated unions."

提交回复
热议问题