F# explicit match vs function syntax

后端 未结 8 2475
耶瑟儿~
耶瑟儿~ 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:49

    This is an old question but I will throw my $0.02.

    In general I like better the match version since I come from the Python world where "explicit is better than implicit."

    Of course if type information on the parameter is needed the function version cannot be used.

    OTOH I like the argument made by Stringer so I will start to use function in simple lambdas.

提交回复
热议问题