Zulip Chat Archive
Stream: lean4
Topic: Elaborator priority
Patrick Massot (Jul 04 2025 at 16:44):
In
import Lean
open Lean Meta Elab
elab "foo%" t:term : term => do
let e ← Term.elabTerm t none
mkAppM `id #[e]
variable (F : Nat → Nat)
#check foo% F 3 -- id (F 3) : Nat
-- how to make it like
#check (id F) 3
How do I avoid foo% consuming all of F 3? The usual algorithm of sticking random precedence numbers in random places didn’t work.
Aaron Liu (Jul 04 2025 at 17:05):
import Lean
open Lean Meta Elab
elab:max "foo%" t:term:max : term => do
let e ← Term.elabTerm t none
mkAppM `id #[e]
variable (F : Nat → Nat)
#check foo% F 3 -- id F 3 : Nat
Aaron Liu (Jul 04 2025 at 17:06):
I stuck random precedence numbers in random places and it worked lol
Aaron Liu (Jul 04 2025 at 17:07):
what did you try?
Patrick Massot (Jul 04 2025 at 17:08):
Thanks Aaron, I forgot that random place!
Aaron Liu (Jul 04 2025 at 17:09):
I'm Aaron not Aron :)
Eric Wieser (Jul 04 2025 at 17:11):
That should maybe be elab:max "foo%" t:term:arg
Patrick Massot (Jul 04 2025 at 17:23):
Sorry about the typo.
Aaron Liu (Jul 04 2025 at 17:37):
Eric Wieser said:
That should maybe be
elab:max "foo%" t:term:arg
What's the difference
Aaron Liu (Jul 04 2025 at 17:38):
oh it doesn't take do
Last updated: Dec 20 2025 at 21:32 UTC