Re: Problem with SetDelayed lhs:=rhs
- To: mathgroup at smc.vnet.net
- Subject: [mg128262] Re: Problem with SetDelayed lhs:=rhs
- From: Bill Rowe <readnews at sbcglobal.net>
- Date: Sat, 29 Sep 2012 20:08:57 -0400 (EDT)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- Delivered-to: l-mathgroup@wolfram.com
- Delivered-to: mathgroup-newout@smc.vnet.net
- Delivered-to: mathgroup-newsend@smc.vnet.net
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)