icegood

290 Reputation

14 Badges

15 years, 227 days

MaplePrimes Activity


These are questions asked by icegood

p := proc() a:=1; b:=2; a/b end proc;

subs(1=1.0, eval(p));

proc () local a, b; a := 1.0; b := 2; a^1.0/b end proc;

why it generates a^1.0? It's rather nonsens. How to avoid such behavior?

piecewise not suitable to sum:

restart;
with(codegen):
H:=proc(y,a,b) y+piecewise((y>0), a,b); end proc;
prep2trans(H);
Error, (in intrep/StatSeq) invalid terms in sum: if 0 < y then a else b end if


Any walkarounds?

For given expression expr it's known that  type(expr, function) returns true. How to grab name of that function in fast way?

Unserstood that in slow way could be transform to string done and after that could be found substring till 1st '(' symbol. But i'm sure that name somewhere 'sits' directly.

After understanding how one part of code works i also see that it uses trick of eval (namely "procedural substitution"):

restart;
r:=f(g(u), h(w)):
eval(r, [g=proc() ll; end proc]):

gets full substitution with arguments

and

restart;
r:=f(g(u), h(w)):
eval(r, [g=ll]):

do simple one 'by name'.

Where can i read about that?

In next code g is evalhfable while MainF is not. Is it possible to create appropriate local in IntermediateCalc cover (via appropriate assignments) for fres2 to get MainF evalhfable too? ex.mw

First 7 8 9 10 11 12 13 Page 9 of 13