Services & Resources / Wolfram Forums / MathGroup Archive

MathGroup Archive 2012

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

Search the Archive

Re: Problem with SetDelayed lhs:=rhs

  • To: mathgroup at
  • Subject: [mg128684] Re: Problem with SetDelayed lhs:=rhs
  • From: Roland Franzius <roland.franzius at>
  • Date: Sat, 17 Nov 2012 03:47:55 -0500 (EST)
  • Delivered-to:
  • Delivered-to:
  • Delivered-to:
  • Delivered-to:
  • References: <k466r8$a8g$>

Am 29.09.2012 09:09, schrieb zahava.ginny at
> 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.

You can always override Hold-attibutes by Evaluate


or simply using Set


if rhs contains no variables with different values at definition and run 

In a most elegant way - a bit obscure for beginners - automated 
definition procedures prepare Lists with the two arguments of SetDelayed 
and apply SetDelayed to the inner List of pairs

SetDelayed@@@(  ({f[#,j_],rhs[#,j]}&) /@ Range[20] )


(  (sd[f[#,j_],rhs[#,j]]&) /@ Range[20] )/. {sd -> SetDelayed}


Roland Franzius

  • Prev by Date: Re: Euclidean distance of all pairwise combinations (redundants)
  • Next by Date: mEngine from Mathsource
  • Previous by thread: Re: Problem with SetDelayed lhs:=rhs
  • Next by thread: mEngine from Mathsource