Previous Page Next Page Contents

Pref::output -- influence output of objects

Introduction

With Pref::output the output of objects can be influenced.

Call(s)

Pref::output(function)

Parameters

function - function, that influence the output

Returns

the previously defined value

Related Functions

Pref::postOutput, Pref::postInput, Pref::keepOrder

Details

Example 1

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}}"

Changes




Do you have questions or comments?


Copyright © SciFace Software GmbH & Co. KG 2000