Zulip Chat Archive
Stream: Is there code for X?
Topic: Where should mkTuple go
Joachim Breitner (Nov 23 2023 at 17:48):
This question is dual to the usual one on this channel: I have a function, but I need the right place for it.
Which Lean module is the natural home for this function:
/--
Create Tuple syntax (`()` if the array is empty, and just the value if its a singleton)
-/
def mkTupleSyntax : Array Term → MetaM Term
| #[] => `(())
| #[e] => return e
| es => `(($(es[0]!), $(es[1:]),*))
Scott Morrison (Nov 23 2023 at 21:57):
If Std.Lean.Syntax
had already existed, I would say there. Possibly still there.
Joachim Breitner (Nov 23 2023 at 21:57):
I need it in core, though
Scott Morrison (Nov 23 2023 at 22:00):
Right next to src#Lean.Elab.Term.mkPairs?
Scott Morrison (Nov 23 2023 at 22:01):
Maybe just right at the point you need it, until there is evidence it warrants going somewhere higher.
Joachim Breitner (Nov 23 2023 at 22:02):
Somehow I recall someone saying “ah, that (mkPairs
)’s defined before we have quotations”. But yes, if I can use `(…)
there then that’s natural. I should just try :-)
Mario Carneiro (Nov 24 2023 at 17:07):
you can use quotations anywhere, although for quotations in Init you can't use syntax that hasn't been defined yet
Last updated: Dec 20 2023 at 11:08 UTC