Is it possible to preserve a specific style of notation in $Mathematica$ output?
foo // bar (* bar[foo] *) Hold[foo // bar] (* bar[foo] *)
I'm writing some code that generates sample code (e.g. a usage hint), and in one case I feel that postfix notation is easier on the eyes. I know it's subjective and not that important but now I'm just curious whether this is possible to control.
Postfix preserves the notation as @rasher pointed out. However, my intent was to allow convenient evaluation of sample code by being able to immediately evaluate the output—that is, ShiftEnter the
Postfix is the head of an expression though, the evaluation simply returns the expression—which, makes complete sense, since that's what
Postfix... does. (This question almost seems circular now.)
Is there a way, perhaps, to create a custom
PostfixToEvaluate head that would display the expression in postfix but, maybe via an UpValue, remove itself and evaluate its contents, upon evaluation? (I don't know if that makes any sense. I'm going to try it now...)
Tags I considered but don't believe are relevant: stylesheet hold expression-manipulation. Note that I've left "hold" in the title as that's the intuitive keyword by which I would have searched, were I a future visitor.