Question: Encapsulated transformation of expression to compiled function

How to do subj? Straightforward way doesn't compile:


myint:= proc(u::float)::float;
return int(exp(x^6), x=0.0..u);
end proc:

createcomp:=proc (expr::evaln, exprfunc::evaln);
return Compiler:-Compile(exprfunc,optimize);
end proc:
s:=createcomp(global_expr, global_exprfunc);

"Error, (in Print) cannot translate value of lexically scoped parameter `expr'". So, compiler see how to calculate value of local exprfunc but doesn't see how to calculate expr... Is it somehow related to absence of nested functions support? Also want to compile global_expr "as is" i.e. in this example myint(a) should be compiled to call of myint from maple while a^a should be compiled to internal pow(a,a) call.

Please Wait...