
%begin
%routine Tabulate (%longrealfn func(%longreal x),%longreal from,to, 
   %integer steps)
! func(x) is the dummy formal function
%real value,inc
%integer i
!
inc=(to-from)/steps
!
value=from
%for i=0,1,steps %cycle
   print(value,4,2) ; print(func(value),10,4) ; newline
   value=value+inc
%repeat
%end ;!  of routine tabulate
!
! now call with some functions....
printstring("
    x               sine(x)
")
tabulate ( sin, 0.0,pi/2,10)
! note that the function name appears WITHOUT parameters in the call
!
printstring("
    x         squareroot(x)
")
tabulate( sqrt, 0.0,10.0,5)
!
%endofprogram
