obtain pretty-printed form of expressions
The function print_preprocess returns the pretty-printed form of an expression, as print would display it.
In particular, procedures of the form `print/foo` are applied to functions foo(a, b, ...) and ModulePrint procedures are applied to modules. This is particularly useful when you write a `print/foo` or ModulePrint procedure and want to display a subobject.
The module m below displays in the same way as its member m:-a, but with square (list) brackets around it.
m := module()
local ModulePrint := proc()
m:-a ≔ 5:eval⁡m
m:-a ≔ LinearAlgebra:-RandomMatrix⁡20:eval⁡m
The function foo(...) displays in reverse.
`print/foo` := proc()
local oof, i;
return oof(seq(print_preprocess([_passed][i]), i = _npassed .. 1, -1));
m:-a ≔ foo⁡1,2:eval⁡m
Download Help Document
What kind of issue would you like to report? (Optional)