Pref::output -- influence output
of objects
IntroductionWith Pref::output the output of objects can be
influenced.
Call(s)Pref::output(function)
Parametersfunction |
- | function, that influence the output |
Returnsthe previously defined value
Related
FunctionsPref::postOutput,
Pref::postInput,
Pref::keepOrder
DetailsPref::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.
Example
1All 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}}"