Task

Pass a function     as an argument     to another function.



Related task

   First-class functions


 
'FUNCTION TO BE PASSED
'=====================
 
function f(double d,e) as double
  return (d+e)*2
end function
 
 
'FUNCTION TAKING A FUNCTION AS AN ARGUMENT
'=========================================
 
function g(sys p) as string
 
  declare function x(double d,e) as double at p
 
  return x(10,11)
 
end function
 
 
'TEST: PASSING ADDRESS OF FUNCTION f
'===================================
 
'the name 'f' is combined with the prototype signature '#double#double'
'@' signifies the address of the function is being passed
 
print g(@f#double#double) 'result '42'
 
 