MathGroup Archive 2010

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

Search the Archive

Re: := vs = in some function definitions

  • To: mathgroup at smc.vnet.net
  • Subject: [mg113280] Re: := vs = in some function definitions
  • From: Bob Hanlon <hanlonr at cox.net>
  • Date: Thu, 21 Oct 2010 07:05:04 -0400 (EDT)

Anytime the function cannot be evaluated without a numerical value

f[x_, n_: 50] := IdentityMatrix[n].Append[Range[n - 1], x];


Bob Hanlon

---- Sam Takoy <sam.takoy at yahoo.com> wrote: 

=============
Hi,

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 :=   ?

It seems that using   :=  will condemn the function to repeated extra 
work every time its called. So could there be a situation where the use 
of ":=" for the above function is recommended?

Many thanks in advance,

Sam



  • Prev by Date: palettes that would not move
  • Next by Date: Re: := vs = in some function definitions
  • Previous by thread: Re: := vs = in some function definitions
  • Next by thread: Re: := vs = in some function definitions