MathGroup Archive 2010

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

Search the Archive

Re: := vs = in some function definitions


On Oct 20, 10:06 am, Sam Takoy <sam.ta... at yahoo.com> wrote:

> Have read everything I could find regarding delayed assignment, I'm
> still not quite sure when to use which.
>
> For example, in the definition
>
> f[x_] = IdentityMatrix[50].Append[Range[1, 49], x];
>
> could there ever be any reason to use :=   ?


If x has a value when you evaluate your definition, il will be used in
the definition, which is not usually what you want.
For example, try :

x = 4

Clear@f; f@x_ = 2 x

?f







  • Prev by Date: Fitting the solution of a differential equation to a data set
  • Next by Date: palettes that would not move
  • Previous by thread: := vs = in some function definitions
  • Next by thread: Re: := vs = in some function definitions