Mathematica 9 is now available
Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2005

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

Search the Archive

Re: basic issue with do and :=

  • To: mathgroup at
  • Subject: [mg60444] Re: basic issue with do and :=
  • From: "dkr" <dkrjeg at>
  • Date: Fri, 16 Sep 2005 03:50:39 -0400 (EDT)
  • References: <dgbevg$fol$>
  • Sender: owner-wri-mathgroup at

>> Is there any compact way to define: "b[i] :=a[i]+1" for all i ?

Use a pattern variable on the lefthand side:


In your expression Do[b[i] :=a[i]+1, {i, 10}] , what is happening is
that i gets set to a certain value, that value is then fed to b[i] (but
not a[i]+1, since SetDelayed does not immediately evaluate its
righthand side.

  • Prev by Date: number of digits in n^p
  • Next by Date: Re: Replacement rule for a quotient
  • Previous by thread: Re: basic issue with do and :=
  • Next by thread: Re: basic issue with do and :=