fsprojects / fsharp-cheatsheet

This cheatsheet aims to succinctly cover the most important aspects of F# 6.0.
http://fsprojects.github.io/fsharp-cheatsheet/
Other
327 stars 59 forks source link

Prefer deconstruct to named values over fst/snd #16

Closed SpiralOSS closed 11 months ago

SpiralOSS commented 11 months ago

In general I avoid fst and snd and always deconstruct explicitly like this, ignoring the one I don't want. The main exception to that is that I'll use fst for e.g. xs |> Seq.map fst The main trigger for me suggesting anyting is that aa and bb dont mean anything, so I tend to call two equivalent args (esp where there is not real order to them) x and y Main reasoning is that pattern matching is something you want to encourage use of as it nudges in good directions for code in general, whereas a sea of fst this snd that rarely ends up producing scannable code.

_Originally posted by @bartelink in https://github.com/fsprojects/fsharp-cheatsheet/pull/14#discussion_r1359371797_