Zulip Chat Archive

Stream: lean4

Topic: Identifier with number


Marcus Rossel (Sep 17 2022 at 06:43):

Is it possible to use identifiers with numbers in them for the def or inductive commands - e.g. inductive Foo.1.Bar?
I tried:

open Lean in
macro "gen" : command => do
  let i := mkIdent $ .str (.num (.str .anonymous "x") 1) "y"
  `(inductive $i)

gen -- invalid 'end', insufficient scopes

James Gallicchio (Sep 17 2022 at 06:57):

I think numbers right after the dot are reserved for projections? But you can do ._1

James Gallicchio (Sep 17 2022 at 06:58):

There was a description somewhere in the metaprogramming tutorial about how .num is reserved for internal use, I don't remember for what exactly


Last updated: Dec 20 2023 at 11:08 UTC