Zulip Chat Archive
Stream: general
Topic: converting between `[foo] and "foo"
Scott Morrison (Feb 12 2020 at 21:45):
I'm finding myself needing both the pexpr
s: `[foo]
and "foo"
. Does anyone know how to convert in either direction?
Rob Lewis (Feb 12 2020 at 22:14):
I don't think this is really doable. Check the output of run_cmd trace $ ``(`[simp])
Floris van Doorn (Feb 12 2020 at 22:44):
I think this converts "foo"
to `[foo]
:
open tactic lean lean.parser interactive @[user_command] meta def add_hint (_ : parse (tk "add_hint")) : parser unit := do n ← parser.pexpr, n ← to_expr n, s ← eval_expr string n, let t := "`[" ++ s ++ "]", t ← with_input parser.pexpr t, trace s, trace t, skip open tactic add_hint "simp"
Scott Morrison (Feb 13 2020 at 17:04):
Thanks.
Last updated: Dec 20 2023 at 11:08 UTC