Re: Pointer to function in Euphoria

new topic     » goto parent     » topic index » view thread      » older message » newer message
 
function f(atom x) return x*x end function 
integer fid = routine_id("f") 
 
function g(atom x) return 2*x end function 
integer gid = routine_id("g") 
 
function h(atom x) return x*x*x end function 
integer hid = routine_id("h") 
 
function doit(integer func, atom a, atom b)  
   return call_func(func, {a}) + call_func(func, {b}) 
end function 
 
atom y  
 
y = doit(fid, 3.14159, 2.71828) 
printf(1, "y1 = %f\n", y) 
 
y = doit(gid, 1, 2) 
printf(1, "y2 = %f\n", y) 
 
y = doit(hid, 3, 4) 
printf(1, "y3 = %f\n", y) 
 
new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu