I'm trying to make a function f
that takes a symbol, a value, and a context, and creates the symbol in the requested context and assigns it the passed value. The obvious doesn't work. I.e.:
Attributes[f]={HoldAllComplete};
f[symbol_,value_,context_]:=(Begin[context];Set[symbol,value];End[])
Creates the symbol in the current context, as opposed to the one that is passed as an argument. This seems to happen because the FrontEnd, as soon as it sees f
getting evaluated, creates the symbol in the current context despite HoldAllComplete
. I tried adding Remove[symbol]
to the function but that doesn't work. Any thoughts?