performance - Which way of these two pattern matching is more preferred? -



performance - Which way of these two pattern matching is more preferred? -

i'm curious, these 2 functions same thing. 1 should use?

let f = match b -> a;; allow f = match b -> b;;

or depends on preference? sense sec 1 improve i'm not sure.

performance wise there no difference. style-wise b -> a bit problematic because have unused variable b. _ -> a create more sense. other that, it's preference.

personally prefer _ -> a on b -> b because doesn't introduce variable.

ps: assume in real code there more cases b - otherwise write let f = a.

performance functional-programming pattern-matching ocaml preference

Comments

Popular posts from this blog

javascript - mongodb won't find my schema method in nested container -

How do you set up a perforce server to work over the internet? -

ios - Lagging ScrollView with UIWebview inside -