Zulip Chat Archive
Stream: lean4
Topic: while let
Reid Barton (Dec 28 2022 at 20:28):
Is there such a thing as while let ... do
(pattern match in a loop, and exit if the match fails)?
Mario Carneiro (Dec 28 2022 at 20:31):
No, but I don't see any reason not to. You can do it with repeat
and break
I think
Mario Carneiro (Dec 28 2022 at 20:31):
well, there is the issue that Do.lean
is frozen
Mario Carneiro (Dec 28 2022 at 20:31):
but it might be a good idea to record it as an issue so we can come back to it later
Reid Barton (Dec 28 2022 at 20:38):
https://github.com/leanprover/lean4/issues/1996
Gabriel Ebner (Dec 28 2022 at 22:00):
You should be able to write that yourself as a macro. Expand while let pat := t do body
to repeat if let pat := t then body else break
Last updated: Dec 20 2023 at 11:08 UTC