MathGroup Archive 2007

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

Search the Archive

Re: How to manipulate globals in a function?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg73772] Re: How to manipulate globals in a function?
  • From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
  • Date: Wed, 28 Feb 2007 04:29:40 -0500 (EST)
  • Organization: Uni Leipzig
  • References: <erop34$94v$1@smc.vnet.net>
  • Reply-to: kuska at informatik.uni-leipzig.de

Hi,

and simsalibim & abrakadabra

SetAttributes[Moo, HoldFirst]

Moo[A_, i_Integer] :=(A[[i]] = 7)

will work.

Regards
   Jens

davisjf at gmail.com wrote:
> I am trying to write code to manipulate a global array in a function.
> How do something like this:
> 
> Moo [A_List, i_Integer] :=
> 
>       A[[i]] = 7;
> 
> Moo[A, 1]
> 
> This fails.  But, if I do this without a funciton it works.
> 
> i=1
> A[[i]] = 7
> 
> JD
> 
> 


  • Prev by Date: Re: Re: deleting a title or subtitle in a notebook
  • Next by Date: Re: 1>0 gives False
  • Previous by thread: Re: How to manipulate globals in a function?
  • Next by thread: multi-threading on Mac OS X.