New EEP draft: Pinning operator ^ in patterns
Michael P.
empro2@REDACTED
Fri Jan 29 21:52:17 CET 2021
On Fri, 29 Jan 2021 08:23:45 +0900
zxq9 <zxq9@REDACTED> wrote:
> On 2021/01/29 7:31, Michael P. wrote:
> > Scoping is easy:
> >
> > Every pattern, apart from LHS `=`, opens a new scope.
> ...except for the most common pattern matching situation of all: `case`
Fool! (I! not you!)
> Not having anonymous function heads and list comprehension iterators
> follow the way patterns work in case is jarring and probably the main
How do ppl react to these "sneak-exports"?
Like those one-armed bandits: if you get one in each,
you do not have to return it but it's a give-away.
(Whether you want it or not!)
> One Scope To Rule Them All is the cognitively consistent approach
> because closures exist.
Call me Mr Stupid / Call me Mr Wrong / Call me insane, but
I had lines like these cooking in a draft for months,
wanted to try it when this all started:
```Kiwi format
What = (fun If() when A >= B -> A
; If() when A < B -> B
end)(),
Selector = 2,
Switch = {4, 5},
Case = (fun Case({Check, Pay}) when Check >= Selector -> {Check, Check - Pay}
; Case({Check, Pay}) when Check < Selector -> -1
end)(Switch).
```
Ash fun thrakatulûk
agh closure-ishi krimpatul.
-- [looked this up, not that mad ;-]
~M
--
Reasonable is that which cannot be criticised reasonably anymore.
Vernüftig ist das, was nicht mehr vernünftig kritisiert werden kann.
More information about the erlang-questions
mailing list