ppp
Pete’s Pretty Print
Prints any object to screen, file, or returns a string.
Long sequences are automatically line-wrapped and optionally displayed in a neat (vertically aligned) nested format.
These routines are fully supported by pwa/p2js.
The interface consists of three routines (defined in builtins\ppp.e, an autoinclude):
ppOpt(sequence options) Permanently (or until next ppOpt call) change selected formatting options.
pp(object o, sequence options={}) Pretty print the specified object.
string s = ppf(object o, sequence options={}) Return object pretty printed (with embedded \n), no trailing \n.
Examples:
In the above examples, note how the 1, {, and 1 display in the same column.
If an indent level is specified, spaces are inserted in the "{1" to maintain alignment.
Prints any object to screen, file, or returns a string.
Long sequences are automatically line-wrapped and optionally displayed in a neat (vertically aligned) nested format.
These routines are fully supported by pwa/p2js.
The interface consists of three routines (defined in builtins\ppp.e, an autoinclude):
ppOpt(sequence options) Permanently (or until next ppOpt call) change selected formatting options.
pp(object o, sequence options={}) Pretty print the specified object.
string s = ppf(object o, sequence options={}) Return object pretty printed (with embedded \n), no trailing \n.
Examples:
obj={1,{2,{3,3},2},1}
pp(obj,{pp_Nest,0}) gives:
{1, {2, {3,3}, 2}, 1}
pp(obj,{pp_Nest,1}) gives:
{1,
{2, {3,3}, 2},
1}
pp(obj,{pp_Nest,2}) gives:
{1,
{2,
{3,3},
2},
1}
nest may also be a sequence of {indent,nest_level}.In the above examples, note how the 1, {, and 1 display in the same column.
If an indent level is specified, spaces are inserted in the "{1" to maintain alignment.
pp(obj,{pp_Nest,{2,2}}) gives:
{ 1,
{ 2,
{ 3,3},
2},
1}
pp(obj,{pp_Nest,{3,2}}) gives:
{ 1,
{ 2,
{ 3,3},
2},
1}