up previous next

Call

Syntax

Call(F:FUNCTION,X_1,...,X_n):OBJECT

where X_1,...,X_n are the arguments for the function F.
    

Summary

apply a function to given arguments

Description

This function applies the function F to the arguments X_1,...X_n.

example

    
The following function MyMax takes a function LessThan as parameter,
and returns the maximum of X and Y w.r.t. the ordering defined by the
function LessThan.

Define MyMax(LessThan,X,Y)
  If Call(LessThan,X,Y) Then Return Y Else Return X EndIf
EndDefine;

Let's use MyMax by giving two different orderings. 

Define LT_Standard(X,Y)
  Return X < Y;
EndDefine;
Define LT_First(X,Y)
  Return TRUE;
End;

MyMax(Function("LT_Standard"),3,5);
5
-------------------------------
MyMax(Function("LT_First"),5,3);
3
-------------------------------
MyMax(Function("LT_First"),3,5);
5
-------------------------------
MyMax(Function("LT_First"),5,3);
3
-------------------------------
        
    

See Also