The intent was to
- replace naked code with a name.
- give that code access to all identifiers via the closure - if I happen to be too lazy to express the necessary information as parameters, which I’m not 99.99999% of the time.
On top of that you’d get the less awkward function call out of using a
defp
.
I wholeheartedly agree.
I’m not advocating for cramming whatever you want in these piped
case
statements,
The example given is to me is a Broken Window, the “thin edge of the wedge”. The lambda I gave was simply setting the stage for “just make it another function - even if you have to define/pass some arguments”.
The whole “Naming is difficult” excuse is used far too often to justify less readable or inferior code - to get good at naming things you have to keep practicing.