MathGroup Archive 2012

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Problem with SetDelayed lhs:=rhs


On 9/29/12 at 2:56 AM, zahava.ginny at gmail.com wrote:

>An assignment using SetDelayed, lhs := rhs, maintains rhs in
>completely unevaluated form. Thus, if k=5, say, the assignment

>In[1] = f[k,j_]:=rhs[k,j]

You want to define f as

f[k_,j_]:= rhs[k,j]

That is you failed to include and underscore following k That is

In[1]:= f[k_, j_] := rhs[k, j]

In[2]:= f[5, j]

Out[2]= rhs(5,j)

However with your definition you could do:

In[3]:= Clear[f];
f[k, j_] := rhs[k, j]

In[5]:= k = 5;
f[k, j]

Out[6]= f(5,j)




  • Prev by Date: Re: How to lock down a Dynamic object in a report
  • Next by Date: Re: Clearing all variables and definitions: i.e. "resetting" mathematica
  • Previous by thread: Re: Problem with SetDelayed lhs:=rhs
  • Next by thread: How to lock down a Dynamic object in a report