Zulip Chat Archive

Stream: new members

Topic: overload `\[[ \]]`


Cody Roux (Mar 03 2024 at 03:32):

How can I declare a notation that rebinds the \[[ \]] syntax? It seems that declaring a notation at level 50 does not suffice, any subsequent uses are still parsed as members of some quotient.

Eric Wieser (Mar 03 2024 at 14:01):

What do you mean by "at level 50"?

Eric Wieser (Mar 03 2024 at 14:02):

It sounds like you might be confusing priority with precedence

Cody Roux (Mar 03 2024 at 16:09):

maybe! I just did notation:50 "⟦" φ "⟧" => some_def, and cannot seem to use my notation.

Eric Wieser (Mar 03 2024 at 16:39):

Yes, that's precedence not priority

Eric Wieser (Mar 03 2024 at 16:39):

(priority := 2000) is how you specify the latter

Kevin Buzzard (Mar 03 2024 at 17:29):

Another option is just to use different brackets, unicode has a gazillion

Kyle Miller (Mar 03 2024 at 21:33):

or notation (priority := high) "⟦" φ "⟧" => some_def rather than specifying a number for the priority.

Precedence is used to disambiguate overlapping parses, by having it so that notations can say "only allow something that parses with precedence level >= N in this position".

Cody Roux (Mar 04 2024 at 03:22):

@Kevin Buzzard Fair point, though this is the standard notation for what I am trying to define (and as a computer scientist, I feel like there are a couple missing).

Cody Roux (Mar 04 2024 at 03:26):

Thanks all


Last updated: May 02 2025 at 03:31 UTC