Consider an association which contains a key which must not be prematurely evaluated.
assoc = <| key :> value |>
For example, a value of
a[[b]] would throw a
Part error until symbols
b are substituted.
We might wish to obtain this value in its unevaluated form, e.g. to display. Simply calling
value (and in that example, throw a
One trick is to exploit that matched patterns are unevaluated:
assoc /. KeyValuePattern[ key :> v_ ] -> Hold[v]
but this seems needlessly hacky for what must be a common operation.
What's the right way to obtain