Pref::output
-- influence output
of objectsWith Pref::output
the output of objects can be
influenced.
Pref::output(function)
function |
- | function, that influence the output |
the previously defined value
Pref::postOutput
,
Pref::postInput
,
Pref::keepOrder
Pref::output
a function can be defined that
manipulates the output of objects.Pref::output
without arguments will return
the current value. The argument NIL
will reset the default
value, which is NIL
.All numbers shall be displayed as floating point
numbers, but the input and calculations should not be influenced.
Therefor a function, that applies float
to all numeric objects, will be mapped to all objects of the result.
>> Pref::output( proc() begin map(args(), proc(num) begin if testtype(num, Type::Numeric) then float(num) else num end_if end_proc) end_proc): 1, 528/44, 194/8, 2 + 4/5*I
1.0, 12.0, 24.25, 2.0 + 0.8 I
In the next example the procedure generate::TeX
will be applied to every
output, before any object will be displayed.
>> Pref::output(generate::TeX): sqrt(x^2 - 1/x)
"\\sqrt{x^2 - \\frac{1}{x}}"