Zulip Chat Archive
Stream: lean4
Topic: Let pattern matching
Daniel Weber (Aug 25 2024 at 10:46):
Currently pattern matching with let
doesn't keep the definition of the value. I believe this conflicts with the rest of the behavior of let
and is confusing (example 1, example 2, example 3), and so should either:
- be removed/linted against, and
have pattern := value
will have to be used instead. - be changed so it keeps the definition - e.g.
let (a, b) := l
will behave likelet a := l.1; let b := l.2
- this would probably require quite some effort, I'm not sure how pattern matching is implemented.
Eric Wieser (Aug 25 2024 at 22:19):
If you want to "keep the value", you can use match h : value with pattern =>
instead
Eric Wieser (Aug 25 2024 at 22:19):
But 1) sounds quite reasonable to me
Daniel Weber (Aug 28 2024 at 04:51):
Should I make an RFC?
Daniel Weber (Aug 30 2024 at 07:25):
Last updated: May 02 2025 at 03:31 UTC