print_preprocess - Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : print_preprocess

print_preprocess

obtain pretty-printed form of expressions

 

Calling Sequence

Parameters

Description

Examples

Calling Sequence

print_preprocess(e)

Parameters

e

-

any expressions

Description

• 

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.

Examples

The module m below displays in the same way as its member m:-a, but with square (list) brackets around it.

m := module()
  export a;
  local ModulePrint := proc()
    return [print_preprocess(a)];
  end proc;
end module:

m:-a5:evalm

5

(1)

m:-aLinearAlgebra:-RandomMatrix20:evalm

20 x 20 MatrixData Type: anythingStorage: rectangularOrder: Fortran_order

(2)

The function foo(...) displays in reverse.

`print/foo` := proc()
local oof, i;
  return oof(seq(print_preprocess([_passed][i]), i = _npassed .. 1, -1));
end proc:

foo1,2

oof2,1

(3)

m:-afoo1,2:evalm

oof2,1

(4)

See Also

ModuleDeconstruct

ModulePrint

print