How might I construct a function of the form Rep[defs,code]
, graphic[code]
and display[code]
Such that the following outputs can occur?
Rep[
y[a__] := Graphics[{Circle[],
Inset[
graphic[a]
, Scaled[{0.498, 0.5020000000000002}], Center,
Scaled[{0.5, 0.5}]]}, ImagePadding -> 0,
PlotRangePadding -> 0];
Times[a_, b_] := Graphics[{RGBColor[1, 0, 0], Rectangle[{0, 0}],
Black, Inset[
display[a*b]
, Scaled[{0.498, 0.5020000000000002}], Center, Scaled[{0.5, 0.5}]]
}, ImagePadding -> 0, ImageSize -> {85., Automatic},
PlotRangePadding -> 0];
, graphic[y[y[a*b]]]
]
Rep[
Sum[f_, {i_, max_}] :=
Graphics[{Circle[],
Inset[
Sum[f, {i, max}]
, Scaled[{0.498, 0.5020000000000002}], Center,
Scaled[{0.5, 0.5}]]}, ImagePadding -> 0,
PlotRangePadding -> 0],
graphic[Sum[x^2 , {x, 10}]]
]
Here is my current attempt of creating Rep[funs,code]
. The biggest problem that I have currently, is that I am trying to define custom functions on top of System attributes(Times
& Plus
). In addition I was originally going to add a namespace Gr
to the passed in variables but I feel that there is likely a better way.
Questions are welcome around the current implementation or a slightly better/different implementation.
My question: How can I construct the functions above such that they satisfy the graphic outputs?
Times
andPlus
can't be reassigned it scenarios like this 2*3. That has lead me to replacing all values to slightly modified forms to get around this issue. $\endgroup$