I’m having a very simple but nasty problem with mathematica:
I need/want to enter symbols using a leading zero
\[alpha]^0123
or even simpler just
mysymbol[0123]
which I then transform to my internal representation
(using the Notation package and IntegerDigits[] or Characters[])
==> myrep[{0,1,2,3}]
everything works fine for input without a leading 0.
BUT WHATEVER I TRY (Unevaluated[] or Hold[]), mathematica (it’s overarching evaluator?) will transform the Integer
0123 => 123
so the 0 will be missing from my list
Of course, I could avoid the problem by requiring quotes or commas for the input, but that’s rather unpretty!
ANY IDEAS?
I answered this question in a definitive tone, but I was wrong. Expressions such as
0123,16^^8band1*^6are not converted during parsing as I had incorrectly recalled. For this reason we would not need to fall back to the heavy duty and unwieldy CellEvaluationFunction but can instead use the much more user-friendly$PreRead.This is still a little dangerous as once the definition to
$PreReadis made it changes all input, even attempts to change$PreRead. For example, if we were to set$PreRead = Null &it would become impossible to enter additional commands until the Kernel was restarted.To enact your desired behavior as I understand it we may use:
Testing: