Zulip Chat Archive
Stream: general
Topic: Printing of multiple optional argument
fonqL (Jul 23 2024 at 14:12):
def f (a: Nat) (b := 1) (c := 2) (d := 3) := a + b + c + d
#check f 0 -- f 0 1 2 : Nat
It's a bit strange.
My expected behavior is f 0
or f 0 1 2 3
.
Julian Berman (Jul 23 2024 at 14:44):
That does seem strange, I think that would be a small Repr
bug? And probably worth filing on the Lean 4 repo.
fonqL (Jul 23 2024 at 15:25):
Yaël Dillies (Jul 23 2024 at 15:41):
You can type lean4#4812
and Zulip will display it as lean4#4812
Matthew Ballard (Jul 23 2024 at 15:42):
Or just lean#4812
fonqL (Jul 23 2024 at 16:04):
Oh thanks. I used to think that lean4#num
was pointing to a PR and I just find that issues and PRs share the same serial number. :exploding_head:
Kyle Miller (Jul 23 2024 at 16:46):
Thanks for reporting it. It's a known (but until-now unreported) issue, where the algorithm for pretty printing optional arguments only considers omitting the last optional argument here.
Fixing this is low-priority, but getting :+1:'s on that issue could help motivate putting effort into improving the pretty printing.
Kyle Miller (Jul 23 2024 at 16:48):
(By the way @Julian Berman, the Repr
typeclass is not used for expression pretty printing, like what #check
does — one way you can tell the difference is whether expressions in the output have hovering information. Repr
is used by #eval
though.)
Julian Berman (Jul 23 2024 at 16:50):
Aha, interesting, thanks for the correction.
Last updated: May 02 2025 at 03:31 UTC