Mathematica 9 is now available
Student Support Forum
Student Support Forum: 'pure function arguement problem' topicStudent Support Forum > General > "pure function arguement problem"

< Previous CommentHelp | Reply To Comment | Reply To Topic
Author Comment/Response
yehuda ben-shimol
09/23/07 1:49pm

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
{HoldAll, Protected}

so, the way to do it is TO ENFORCE evaluation with an Evaluate function

f = Function[Evaluate[sa], 2^pp1 3^pp2]

f[2,3] will return 108 as expected


URL: ,

Subject (listing for 'pure function arguement problem')
Author Date Posted
pure function arguement problem m prior 09/18/07 5:18pm
Re: pure function arguement problem yehuda ben-s... 09/23/07 1:49pm
< Previous CommentHelp | Reply To Comment | Reply To Topic