| Author |
Comment/Response |
yehuda ben-shimol
|
09/23/07 1:49pm
Hi,
Notice that
f = Function[sa, 2^pp1 3^pp2]
returns (in InputForm)
Function[sa, 2^pp1*3^pp2]
that is, the value of variable sa is not transferred to the Function[] body, and this is due to the fact that Function has a HoldAll attribute
Attrbites[Function]
returns
{HoldAll, Protected}
so, the way to do it is TO ENFORCE evaluation with an Evaluate function
f = Function[Evaluate[sa], 2^pp1 3^pp2]
so
f[2,3] will return 108 as expected
best
yehuda
URL: , |
|