MathGroup Archive 2012

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

Search the Archive

Re: Problem with SetDelayed lhs:=rhs

  • To: mathgroup at smc.vnet.net
  • Subject: [mg128679] Re: Problem with SetDelayed lhs:=rhs
  • From: "Chris Degnen" <degnen at cwgsy.net>
  • Date: Fri, 16 Nov 2012 01:52:16 -0500 (EST)
  • 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
  • References: <k466r8$a8g$1@smc.vnet.net>

You could just draw in the value of k outside the pattern match:

k = 5;
f[j_] := rhs[k, j];
f[4]


zahava asked:
>
> 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]
>
> yields
>
> In[2] = ?f
> Global`f
> f[5,j_]:=rhs[k,j]
>
> How can I force the k on the right hand side to be evaluated so that ?f 
> will yield
> f[5,j_]:=rhs[5,j] ?
>
> Of course, I could define f[5,j_] manually, but I want to automate the 
> procedure over a range of values of k.
> 





  • Prev by Date: Re: Relational operators on intervals: bug?
  • Next by Date: Re: Relational operators on intervals: bug?
  • Previous by thread: Re: The risks of Sphere export
  • Next by thread: Re: Problem with SetDelayed lhs:=rhs